Jump to content




[ Help ] Access Denied


  • You cannot reply to this topic
8 replies to this topic

#1 AnthonyD98™

  • Members
  • 193 posts
  • LocationAuckland, 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 )

#2 tesla1889

  • Members
  • 351 posts
  • LocationSt. 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

#3 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

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.

#4 AnthonyD98™

  • Members
  • 193 posts
  • LocationAuckland, New Zealand

Posted 07 February 2013 - 08:32 PM

View PostTheOriginalBIT, on 07 February 2013 - 08:29 PM, said:

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.

#5 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 07 February 2013 - 08:35 PM

View PostAnthonyD98, on 07 February 2013 - 08:32 PM, said:

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?

#6 AnthonyD98™

  • Members
  • 193 posts
  • LocationAuckland, New Zealand

Posted 07 February 2013 - 08:37 PM

View PostTheOriginalBIT, on 07 February 2013 - 08:35 PM, said:

View PostAnthonyD98, on 07 February 2013 - 08:32 PM, said:

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 )

#7 AnthonyD98™

  • Members
  • 193 posts
  • LocationAuckland, New Zealand

Posted 07 February 2013 - 08:39 PM

Your explanation does make sense now.

#8 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 07 February 2013 - 08:42 PM

View PostAnthonyD98, on 07 February 2013 - 08:39 PM, said:

Your explanation does make sense now.
Cool.

#9 AnthonyD98™

  • Members
  • 193 posts
  • LocationAuckland, New Zealand

Posted 07 February 2013 - 08:43 PM

I really do appreciate your help - Even linking me with tutorial pages.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users