Jump to content




Get drive from startup file in disk

computer

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

#1 HometownPotato

  • Members
  • 62 posts

Posted 25 April 2014 - 07:39 PM

If I have a startup script in a floppy disk, is there a way I can get the disk it is in? Since doing "/disk" will get me the first connected disk, it might give me a different disk if I have more than 1 disk drive.

So if I have 2+ disk drivers connected to a computer most with disks, and I insert a disk with a startup file, is there a way to know for sure which drive it was inserted in?

Of course a worst-case scenario that all the disks of drives have a startup file, so I can't just loop to check whether it has a startup file or not.

Is there a way? Or should I say, is it automatic? If I were to do a script from a startup file, would the CD already be the drive or?

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 25 April 2014 - 08:29 PM

You can use shell.getRunningProgram to get the absolute path of the currently running program. If that doesn't work for whatever reason, give the disk a unique label and iterate the attached disk drives looking for it with disk.getLabel(side). When the side is found, use disk.getMountPath(side) to determine which disk folder it is.

#3 HometownPotato

  • Members
  • 62 posts

Posted 25 April 2014 - 08:37 PM

Oh I didn't think of that, thank you.
That leads me to the question, if there are multiple startup files all in disks, are they run at the same time?

#4 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 25 April 2014 - 11:00 PM

Only the first one found is used. The top side has first priority. It uses the table returned by rs.getSides.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users