Posted 22 January 2014 - 05:38 PM
Essentially, in the OS I'm making programs are run in a sandboxed environment to prevent them from shutting the computer down, not overwriting items in the global environment etc. All programs are run in their own folder, with the main file called startup. If there are any APIs, images, etc. they are placed in this folder, then when they are accessed their path acts like they are in the root folder. For example, if you had a file in the program folder called 'text' you could open it with:
This works perfectly fine and is designed so every program will work. However, a problem arises when the program needs to access a file thats not in the programs folder, for example if it were a text editor. To solve this I tried adding true to all FS calls that needed to access global files. This does work, it's not idea as it has to be added, but it works. The only issue is, if you then try to run a program with fs.func(…, true) an error such as 'Expected string' is thrown. Obviously, I don't want to have to make a special version for each program. Thoughts?
fs.open('text', 'r')
This works perfectly fine and is designed so every program will work. However, a problem arises when the program needs to access a file thats not in the programs folder, for example if it were a text editor. To solve this I tried adding true to all FS calls that needed to access global files. This does work, it's not idea as it has to be added, but it works. The only issue is, if you then try to run a program with fs.func(…, true) an error such as 'Expected string' is thrown. Obviously, I don't want to have to make a special version for each program. Thoughts?