I am looking for a simple way to drop a C-code text file (app.c) onto a script so that it will strip off the ‘.c’ and compile it with GCC. I think I am having problems because I can’t seem to get the POSIX path correct.
- gcc -0 app app.c
Thoughts?
I am looking for a simple way to drop a C-code text file (app.c) onto a script so that it will strip off the ‘.c’ and compile it with GCC. I think I am having problems because I can’t seem to get the POSIX path correct.
Thoughts?
This seems to work pretty well.
on open dropped_item
set this_POSIX to POSIX path of dropped_item
set shell_cmd to "gcc -o " & (text 1 thru -3 of this_POSIX) & " " & this_POSIX
tell application "Terminal"
set myTab to do script shell_cmd
repeat until (myTab's history contains shell_cmd)
delay 1
end repeat
repeat while (myTab's busy)
delay 1
end repeat
close (first window) saving no
end tell
end open
Skip Terminal:
on open fileList
repeat with aFile in fileList
set posixPath to POSIX path of aFile
do shell script "gcc -o " & quoted form of (text 1 thru -3 of posixPath) & space & quoted form of posixPath
end repeat
end open