Page 1 of 1

Make a File Directory

PostPosted: Tue Jun 11, 2019 8:38 pm
by aronb
Hi,

I have looked around a bit and cannot seem to find out how to make a file directory to store a text file in.

For example, I have a text file (test.txt)
I want to create a directory, then store the file...

I can can create the file and save it, I just can't figure out how to use Ruby or any module to make a directory to store the file in :?:

Maybe I've just been looking to long for the answer :?

Thanks, Aron

Re: Make a File Directory

PostPosted: Tue Jun 11, 2019 10:05 pm
by trogluddite
Ruby is able to do this via it's Dir module, and it's also possible by using the "Shell Execute" primitive to send a Windows system command.

Here's a module that does it using Ruby, which I prefer because it's easier to define your own action if the folder creation fails. Note that the 'create_folder' routine calls itself recursively with each parent folder name in turn, so it will create all of the folders necessary for the complete path, however deeply they're nested...
create_folder.fsm
(1.26 KiB) Downloaded 64 times

Re: Make a File Directory

PostPosted: Tue Jun 11, 2019 11:15 pm
by RJHollins
Thanks TROG.

I've always used the PRIM FS modules for this deed.

But I got to say, it was one of the messier sections of the schematic [trying to keep connection path clean].

Seems it was always a challenge when transitioning out of FlowStone proper to the exported VST. But I did get
it working as needed. [what I needed was saving a TXT file into a dedicated FOLDER within an Audio Project Folder ... and have it Default to that [chosen] location.

I also used SPROG's technique of Saving parameters in a hidden PreSet Manager. Works nice.

Thanks again for the RUBY way !

Re: Make a File Directory

PostPosted: Wed Jun 12, 2019 5:54 pm
by wlangfor@uoguelph.ca
Thanks, that might come in handy

trogluddite wrote:Ruby is able to do this via it's Dir module, and it's also possible by using the "Shell Execute" primitive to send a Windows system command.

Here's a module that does it using Ruby, which I prefer because it's easier to define your own action if the folder creation fails. Note that the 'create_folder' routine calls itself recursively with each parent folder name in turn, so it will create all of the folders necessary for the complete path, however deeply they're nested...
create_folder.fsm

Re: Make a File Directory

PostPosted: Wed Jun 12, 2019 7:05 pm
by aronb
Very nice!!!

Thank you very much Trog :D

I figured there was something in Ruby... all my searches came back with using GEMS, which of course we can't really use easily :roll:

Aron