Welcome to %s forums

BrainModular Users Forum

Login Register

String methods in script: how to get parent folder of file?

I need help on a Patch
Post Reply
woodslanding
Member
Posts: 1327
Contact:

String methods in script: how to get parent folder of file?

Unread post by woodslanding » 03 Jan 2023, 19:22

I'd like to get the parent path of a file. so HH/mystuff/myfile.txt would return HH/mystuff.

I'm not finding much in the docs that's useful. I see a 'pos' command that could be used to find path delimiters, but not sure how to get the location of the last delimiter.

Also no substring methods I can see in the docs, although I think I've scoured delphi resources before and found some things that worked...

Guess I'll dig through old scripts and see what I can turn up.

EDIT:

DOH! should have looked for file methods. I'm assuming this will do it: function ExtractFilePath(const FileName: String): String;
Custom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify


woodslanding
Member
Posts: 1327
Contact:

Unread post by woodslanding » 04 Jan 2023, 20:02

One tiny related bug? fr?

I note that when a file does not have an extension, ExtractFileExtension returns the entire filename, instead of an empty string. Not too hard to work around, but not what I would expect....
Custom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 86 guests