Attract-Mode Support Forum
Attract-Mode Support => Scripting => Topic started by: zpaolo11x on May 28, 2020, 07:44:30 AM
-
Is it even possible? I need to create a subdirectory to manage tags my way, I can open a file for writing using the file.nut module or directly using squirrel libraries, and the file will be created from scratch if it's not there already, but if the folder is not there, then an error is thrown.
Is there some way from a layout to create a folder?
-
Use system command mkdir.
-
Use system command mkdir.
I'm using
fe.plugin_command("mkdir","folderpath")
It seems to work fine on macOS, gonna check if it's cross platform compatible
-
Use system command mkdir.
I'm using
fe.plugin_command("mkdir","folderpath")
It seems to work fine on macOS, gonna check if it's cross platform compatible
Yep. Even works in OS/2...
https://en.m.wikipedia.org/wiki/Mkdir
-
Yep. Even works in OS/2...
https://en.m.wikipedia.org/wiki/Mkdir
Fantastic! Is that the right way to run the command?
-
Yep. Even works in OS/2...
https://en.m.wikipedia.org/wiki/Mkdir
Fantastic! Is that the right way to run the command?
If it works, it works. However, squirrel has this feature built in with a function called system(cmd).
http://squirrel-lang.org/doc/sqstdlib3.html#d0e1931
-
If it works, it works. However, squirrel has this feature built in with a function called system(cmd).
http://squirrel-lang.org/doc/sqstdlib3.html#d0e1931
Switched to the system(cmd) syntax and it works much better. I have a further question though: is there a way to set the value of a variable to the output of the system(cmd) command? Like
local varname = system (command)
Otherwise I'll have to make do with some output to file :D
-
According to docs, there is no return on the system command. You can direct output to file. However, will attract wait for process to finish? Will you have to keep checking if file created?