What I'm trying to use is this:
cDir = shell.dir() fs.makeDir(cDir,"sel") -- What it should do is get the current directory and then use it in the fs.makeDir --But it returns an error: --Line 2 - Expected String
Thanks, AnthonyD98
Posted 07 February 2013 - 07:45 PM
cDir = shell.dir() fs.makeDir(cDir,"sel") -- What it should do is get the current directory and then use it in the fs.makeDir --But it returns an error: --Line 2 - Expected String
Posted 07 February 2013 - 07:48 PM
fs.makeDir(cDir,"sel")should be
fs.makeDir(cDir.."sel")
CraftOS
> someProgram <-- run the program
<-- base path "/"
> cd somePath <-- change the active directory
somePath> /someProgram <-- run it from this directory
somePath <-- note that its not the programs dir, but the one we are in
somePath>
so how do we fix this? easylocal function getRunningPath() local runningProgram = shell.getRunningProgram() local programName = fs.getName(runningProgram) return runningProgram:sub( 1, #runningProgram - #programName ) endthis gets the running program, which is the full path
somePath/someProgramthen it gets the programs name
someProgramand returns the substring from the full path starting at index 1 and ending at the full path's end minus the length of the programs name
Edited by TheOriginalBIT, 07 February 2013 - 07:56 PM.
Posted 07 February 2013 - 07:50 PM
TheOriginalBIT, on 07 February 2013 - 07:48 PM, said:
fs.makeDir(cDir,"sel")should be
fs.makeDir(cDir.."sel")
Edited by AnthonyD98, 07 February 2013 - 07:51 PM.
Posted 07 February 2013 - 07:56 PM
Edited by AnthonyD98, 07 February 2013 - 07:57 PM.
Posted 07 February 2013 - 07:57 PM
AnthonyD98, on 07 February 2013 - 07:56 PM, said:
0 members, 2 guests, 0 anonymous users