Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I was wondering if this was the best solution:

  • Put the .applescript files under version control
  • Create an installation script to compile the files with osacompile

But there is also the .scptd directory. Or I could put both .applescript and .scpt files under version control?

What is the best solution?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
746 views
Welcome To Ask or Share your Answers For Others

1 Answer

I love @DanielTrebbien's solution, but it is a little too complex for me to expect people to implement in order to use for my github project. A simpler option that just empowers you to see text changes in the diff is to tell the diff process to textconv with osadecompile.

Add to .gitattributes

*.scpt diff=scpt

Add to .git/config

[diff "scpt"]
  textconv = osadecompile
  binary=true

Here is sample diff from my AppleScript-droplet github project

$ git diff
--- a/AppleScript-droplet.app/Contents/Resources/Scripts/main.scpt
+++ b/AppleScript-droplet.app/Contents/Resources/Scripts/main.scpt
@@ -1,3 +1,3 @@
-on open filelist
-       ## Set useTerminal to true to run the script in a terminal
-       set useTerminal to true
+on open file_list
+       ## Set use_terminal to true to run the script in a terminal
+       set use_terminal to true

Big thanks to @DanielTrebbien for his answer that lead me to osadecompile.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...