224 posts
Location
Auckland, New Zealand
Posted 07 February 2013 - 08:14 PM
file = shell.path()
fs.makeDir(file.."/sel")
-- toast:2: Access Denied
I'm in the root directory, how do I fix this?
Thanks, AnthonyD98
( If your wondering why my program is called toast and is so short is because its for testing code for a much bigger program )
404 posts
Location
St. Petersburg
Posted 07 February 2013 - 08:24 PM
shell.path is still set to somewhere in /rom
shell.setPath to change it
btw, no questions asked on program names. there are some weird names out there in the real world too
7508 posts
Location
Australia
Posted 07 February 2013 - 08:29 PM
do a print on shell.path() its like 3 crazy paths in /rom
you clearly didn't read my edit properly in the OTHER thread.
224 posts
Location
Auckland, New Zealand
Posted 07 February 2013 - 08:32 PM
do a print on shell.path() its like 3 crazy paths in /rom
you clearly didn't read my edit properly in the OTHER thread.
Sorry, I didn't really undertstand your edit.
7508 posts
Location
Australia
Posted 07 February 2013 - 08:35 PM
Sorry, I didn't really undertstand your edit.
Then you should have asked me there instead of posting a new topic…
Lets try this again:There is no way to get the currently running programs file path. We have to write it ourself. Like this
function getPath()
local runningProgram = shell.getRunningProgram()
local programName = fs.getName( runningProgram )
return runningProgram:sub( 1, #runningProgram - #programName )
end
fs.makeDir( getPath().."/sel" )
shell.getRunningProgram returns the absolute path of the running program, including the programs name
fs.getName gets that name
then we use
string.sub to get the path from the absolute. to do this we tell it to go from the start of the absolute to the end of the absolute minus the name
does this explanation make more sense?
224 posts
Location
Auckland, New Zealand
Posted 07 February 2013 - 08:37 PM
Sorry, I didn't really undertstand your edit.
Then you should have asked me there instead of posting a new topic…
Lets try this again:There is no way to get the currently running programs file path. We have to write it ourself. Like this
function getPath()
local runningProgram = shell.getRunningProgram()
local programName = fs.getName( runningProgram )
return runningProgram:sub( 1, #runningProgram - #programName )
end
fs.makeDir( getPath().."/sel" )
Now I get it after re-reading your orginal post, and reading this.
Thanks ( Sorry for being . . . . an idoit )
224 posts
Location
Auckland, New Zealand
Posted 07 February 2013 - 08:39 PM
Your explanation does make sense now.
7508 posts
Location
Australia
Posted 07 February 2013 - 08:42 PM
Your explanation does make sense now.
Cool.
224 posts
Location
Auckland, New Zealand
Posted 07 February 2013 - 08:43 PM
I really do appreciate your help - Even linking me with tutorial pages.