After building I need to copy some files around. This has worked nicely so far. One step, however, doesn’t work anymore even though I haven’t changed anything.
I’ve copied a script that works okay in Terminal:
dim cmd as string = "mkdir /Users/beatrixwillius/Documents/\\ Datei/Development/Mail\\ Archiver/code\\ current/Builds\\ -\\ max.rbp/final"
dim theOutput as string = doShellCommand(cmd)
print theOutput
This creates an empty file and then there is an error message: File exists.
Some lines of code before I create another directory with
"mkdir " + CurrentBuildLocation + “/Extras”
and this works okay. So I really don’t understand why the first script doesn’t.
Nope, that’s not the problem, because in this case the error message would be “directory exists” or something like that. I delete the “final” directory before trying the script. Also, I simply ignore the error for final use.
Do you still have “Use Builds folder” checked? If not, the folder is there but gets deleted at the end, maybe that’s the issue?
Also, have you tried to copy this command and paste it into Terminal? Does that work? Could be that the folder is write protected. Or maybe Xojo now secretly creates a “final” file itself. Have you tried it with another name?
[quote=53171:@Beatrix Willius]
I think that Thomas nailed it: “final” must be a reserved word now. Trying with
dim cmd as string = “mkdir /Users/beatrixwillius/Documents/\ Datei/Development/Mail\ Archiver/code\ current/Builds\ -\ max.rbp/smoerebroed”
works fine. Grr…[/quote]
Wouldn’t matter if Xojo reserved FINAL since your not asking Xojo to run that code so it’s reserved words don’t matter
There’s got to be something else
@Norman: but what else can it be??? The exact same code works if I change from “final” to “smoerebroed”. I’m now using an AppleScript.
dim cmd as String = "/usr/bin/osascript -e 'tell application ""Finder"" to make new folder at ""Macci:Users:beatrixwillius:Documents: Datei:Development:Mail Archiver:code current:Builds - max.rbp"" with properties {name:""final""}'"
dim theOutput as string = doShellCommand(cmd)
Not yet 100% where I want it, but at least the folder is created.
@David: I never had thought that createFolder works in a script. Thanks for the tip!
No idea but its not a Xojo issue since mkdir is not something Xojo is executing
I’d do a “run paused” then go into terminal & issue those same commands and see what happens since that will be more similar to what the IDE would do (not quite exactly the same but closer)
mkdir should maybe be written as “/bin/mkdir” but I’d expect some other error to be reported
Here is a routine I have to make a folder (with sub folders) that works for both Mac & Windows:
Function MakeFolder(Txt as String, Unique as Boolean = False) As FolderItem
Txt = Txt.Replaceall(Sep + Sep,Sep)
if Unique then
dim f as FolderItem = GetFolderItem(Txt,FolderItem.PathTypeAbsolute)
if f <> nil then
dim ct as integer = 0
if txt.Right(1) = sep then txt = txt.left(txt.len-1)
while f.Exists
ct = ct +1
f = GetFolderItem(Txt + "_" + str(ct),FolderItem.PathTypeAbsolute)
wend
Txt = f.absolutepath
end if
end if
Dim Results as FolderItem
Dim Sh as new Shell
Dim S as string
if TargetMacOS then
s = "mkdir -p " + chr(34) + "/Volumes/" + replaceall(Txt,":","/") + chr(34)
else
if TargetWin32 then
S = "mkdir " + chr(34) + Txt + chr(34)
else
msgbox("Platform Not Supported.")
end if
end if
Sh.Execute(S)
Results = GetFolderItem(Txt,FolderItem.PathTypeAbsolute)
Return Results
End Function
This works exceptionally well for me. I am sure this code could be adapted for other platforms as well, but all I need are Windows & Mac.