Code: Select all
batchScript = "~/mohoimpd"
Code: Select all
local homeDir = os.getenv("HOME")
batchScript = homeDir .. "/mohoimpd"
Next, I got this error message:
This probably means the batch file "~/mohoimpd" wasn't executed and therefore the file "mohodlst.dat" wasn't created by the batch script.CC:Relink Lost Images wrote:
So that boils down to the following code not being executed properly:
Code: Select all
local result = os.execute ( batchScript ) --no chmod??
Anyway, if I comment out theProgramming in Lua wrote:The function os.execute runs a system command; it is equivalent to the system function in C. It receives a string with the command and returns an error code. For instance, both in Unix and in DOS-Windows, you can write the following function to create new directories:The os.execute function is powerful, but it is also highly system dependent.Code: Select all
function createDir (dirname) os.execute("mkdir " .. dirname) end
Code: Select all
os.remove (batchScript)
Code: Select all
cd "/Users/renevanbelzen/Desktop/relink images/"
ls -d1>mohodlst.dat
If I execute this file in my BASH CLI, this dialogue appears:
Code: Select all
CP756652-A:~ renevanbelzen$ ./mohoimpd
-bash: ./mohoimpd: Permission denied
Code: Select all
CP756652-A:~ renevanbelzen$ chmod +x mohoimpd
CP756652-A:~ renevanbelzen$ ./mohoimpd
And indeed, if you execute
Code: Select all
ls -d1
I changed the script by inserting the chmod command:
Code: Select all
if(platform == "unix") then
local permission = os.execute ( "chmod +x " .. batchScript ) -- chmod
end
local result = os.execute ( batchScript ) -- execute
The code at the end of the CC_RELINK_LOST_IMAGES.createSubDirList function produced this error, probably because the unix command "ls -d1" doesn't do what it is expected to do.CC:Relink Lost Images wrote:
Judging from the name of the function (createSubDirList) I guess the "ls -d1" command should have created a list of all subdirectories over all mounted drives.
Please give me some feedback on this, because I'm really in the dark here. I'm not exactly sure what I'm doing or are supposed to do next.