Hi,
there may be cases when a shell path gets a little tricky.
For instance, I have three .epub file (File1.epub, File2.epub, File3.epub) created from the same source by the same app (Pages) using the same settings, and they are located in different locations.
The first file was created on Oct 8 2019, while the other two on Dec 18 2019. At that time my MBP was running HighSierra.
Moreover, they have the same read/write permissions (in Finder > Info).
Now, running the ‘Old code’ below, the shell would create the “OPS” folder and its content only for the first file.
For the other two files, the shell would give different reasons, form folder not found, to write permission not available and so on.
Only when I changed from s.Execute "cd " + mparent + " ; unzip " + f.NativePath
to
s.Execute "cd " + mparent + " ; unzip " + f.ShellPath
I got the expected results.
So, although I solved the problem (cfr New code, below), I’m curious to know, if possible, the reason for such behavior.
Thanks.
Old code:
dim temp as folderitem = specialfolder.desktop.child("my folder")//I leave out the usual nil/exists checking
dim s as new Shell
dim mparent as string = """" + temp.NativePath + """"//using shellpath mparent will not be gotten in s.exexute
s.Execute "cd " + mparent + " ; unzip " + f.NativePath
while s.IsRunning
Wend
dim ops as FolderItem = temp.Child("OPS")//this folder should be available in all .epub files
dim source() as String
if ops <> nil and ops.Exists then
New code:
dim s as new Shell
dim mparent as string = """" + temp.NativePath + """"//do not use shellpath
s.Execute "cd " + mparent + " ; unzip " + f.ShellPath
while s.IsRunning
Wend
if s.ErrorCode <> 0 then
dim ss as new Shell
ss.Execute "cd " + mparent + " ; unzip " + f.NativePath
while ss.IsRunning
Wend
end if
dim ops as FolderItem = temp.Child("OPS")//this folder should be available in all .epub files
dim source() as String
if ops <> nil and ops.Exists then