Jump to content




Wierd problem with shell.run


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

#1 Creeper9207

  • Members
  • 211 posts

Posted 06 August 2015 - 06:10 PM

this program seems to work fine, but shell.run won't work, any idea why?

sorry for the crappy formatting
function process(dir)
local a = dir:sub(1,1)
if a == "/" then
  fPath="/emu"..dir
else
  fPath="/emu/"..dir
end
return fPath
end
ofsopen = fs.open
pocket = true
ofsexists = fs.exists
ofsisDir = fs.isDir
ofsisReadOnly = fs.isReadOnly
ofsgetName = fs.getName
ofsgetDrive = fs.getDrive
ofsgetSize = fs.getSize
ofsgetFreeSpace = fs.getFreeSpace
ofsmakeDir = fs.makeDir
ofsmove = fs.move
ofscopy = fs.copy
ofsdelete = fs.delete
ofsopen = fs.open
ofsgetDir = fs.getDir
fs.open=function(fn,fm)
b = process(fn)
return ofsopen(b,fm)
end
shell.run("n")

edit: it says "file not found"
and yes, the file is there, and is in the base directory, and ive also tried putting it in the only other dir on the computer

Edited by Creeper9207, 06 August 2015 - 06:19 PM.


#2 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 06 August 2015 - 07:07 PM

Try adding this before the line
return ofsopen(b,fm)

if not fs.exists( b ) then
  error( b .. " was not found!" )
end

That'll tell you want you're trying to run..

#3 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 06 August 2015 - 10:44 PM

"File not found" or "No such program"?

You're remembering to reboot the computer every time you run your code, right? Every time you execute it, a new fs.open will be defined - first you'll have one that points to /emu/*, then one that points to /emu/emu/*, then one that points to /emu/emu/emu/*...

shell.run() itself performs an existence check on the file before it attempts to open it. It'll never get around to opening "/emu/n" if it can't first confirm "n" exists - you'd need to add your path manipulation code to fs.exists() for that. Probably other fs API functions, too.

#4 Creeper9207

  • Members
  • 211 posts

Posted 08 August 2015 - 12:56 AM

yes i did reboot every time

ok yes, i am trying to run /emu/n, new problem, now it says "No such program"

But, the program is running

#5 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 08 August 2015 - 06:04 AM

Ok, so have you performed the fs.exists() override I mentioned yet? It's not optional.

#6 Creeper9207

  • Members
  • 211 posts

Posted 08 August 2015 - 04:04 PM

oh, ok, thank you ill try this asap, just on the side, does anyone know a desktop emulator for windows 10?

#7 valithor

  • Members
  • 1,053 posts

Posted 08 August 2015 - 04:15 PM

View PostCreeper9207, on 08 August 2015 - 04:04 PM, said:

oh, ok, thank you ill try this asap, just on the side, does anyone know a desktop emulator for windows 10?

http://www.computerc...ux-development/

Might work for what you are wanting.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users