Skip to content

Instantly share code, notes, and snippets.

@scripting
Last active September 29, 2017 20:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scripting/f122c9356733ac7373e60ae865fef702 to your computer and use it in GitHub Desktop.
Save scripting/f122c9356733ac7373e60ae865fef702 to your computer and use it in GitHub Desktop.
Example of the kind of code I routinely write for system scripting
local (sourcefolder = user.prefs.dropboxfolder + "public:misc:nodeeditor:fargo.io-code-publisher:");
local (githubfolder = user.prefs.githubfolder + "fargoPublisher:");
local (montaukfolder = user.prefs.dropboxfolder + "montauk:fargopub:");
on copyone (f1, f2) {
file.surefilepath (f2);
try {
if file.readwholefile (f1) != file.readwholefile (f2) {
file.copy (f1, f2)
}
}
else {
file.copy (f1, f2)
}
};
fileloop (f in sourcefolder) { //copy to montauk
local (fname = file.filefrompath (f));
if not (fname endswith ".opml") {
copyone (f, montaukfolder + fname)
}
};
copyone (sourcefolder + "publisher.js", githubfolder + "publisher.js");
copyone (sourcefolder + "package.json", githubfolder + "package.json");
copyone (sourcefolder + "readme.md", githubfolder + "README.md");
speaker.beep ()
@scripting
Copy link
Author

This is used as an example in this piece --

scripting/Scripting-News#31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment