SynthMaker

Using Environment Variable to find path

Archive · 2010 10 old posts

From the original SynthMaker forum (2004–2014), with its members’ names and dates.

trogluddite ·

Hi, I'm interested in trying to make it easy to re-skin my GUI's. I'd like to have my PNGs all in a folder which is then read when my exe or vst loads up. This folder would then be kept in the same directory as the exe/plugin for easy installation. Would also be nice to save .ini files for people's favourite MIDI settings etc. After some mucking about, I've come up with using the %CD% system variable to get the filepath of the osm, exe or vst upon loading. (many thanks to DWB for his environment variable module - I'd never have worked out how to do that)

It seems to work OK, I can move a compiled exe to different folders and it seems to always give the right path. However, I'm very shady about how exactly these variables work, and I'm worried that using %CD% (Current Directory) might not be totally reliable (if say, another app is accessing a temp file at the same time). Also, do these variables have consistent names and functions across different windows versions? I don't want to leave users with a blank screen, after all.

Am I on the right track here, or is there a better way to do this?

The Luddite

aliasant ·

Ok. So you say its working on your system. What system are you running ? 🙂

exonerate ·

There's a primitive which does exactly this called "Plugin Folder", just use that. 🙂

Cheers 😉

Exo

Tzarls ·

There´s a primitive called "Plugin Folder" that tells you the path of the exe or dll file....why don´t use it instead? 🙂

infuzion ·

exonerate wrote: There's a primitive which does exactly this called "Plugin Folder", just use that.

While that is true, I think this OSM is worth keeping on the HD, since knowing where %TMP% points to can be handy if one has to save a WAV or text file temporarily. Some people put their VSTs on a drive they don't expect to write to often.

aliasant ·

Well. It didnt work for me with this location: F:\SM Builds 6 Or this one: G:\SM Backup\SM Builds 6

Notice the similarities.

But it works fine with these examples:

F:\Desktop C:\Users C:\Users\aliasant G:\ G:\Program Files\Common Files

After removing the "6" in "SM Builds 6" it works so.

Numbers in directory names is a nono?

trogluddite ·

Wow, thanks for so many replies! 🙂

aliasant wrote: What system are you running ?

Oops - bit dumb of me to forget that! Using Windows XP Pro SP3.

exonerate wrote: primitive which does exactly this called "Plugin Folder"

Would rather not use this because my project is designed to be used stand alone if possible - I would prefer that even users who don't use VST can still use the exe with no loss of features - also I wanted to see if my alternative was possible just out of curiosity.

aliasant wrote: It didnt work for me with this location: F:\SM Builds 6

This is the most important thing - it is demostrated to be unreliable; I think I will go to plan B, to use the user application data folder, as this can be found reliably and does not move.

Thanks again to you all - I have never before used a forum where people are so generous with their help 😍

The Luddite

trogluddite ·

Got the solution I need now, so thanks again for the help. [old link]

The Luddite

Tzarls ·

Well, I haven´t checked your schematics yet so I don´t know what method you are using, but I guess you are using temporary text files to get info in and out of SM. If that is the case, I suggest you to test your apps in Windows Vista - 7, becase those OS are very restrictive regarding the permission to write to certain folders. I made a big protection OSM which worked great using W XP and didn´t work at all in Vista.

trogluddite ·

Tzarls wrote: I suggest you to test your apps in Windows Vista - 7

Oh Yes, Microsoft do like to make life easy for us don't they! 😠 Luckily I've got a couple of mates who are braver than I am, who use the new operating systems. I'll buy them a beer or two and enrol them as beta testers. Your point is well made though; my work around at the moment is to use the user's application data folder - but I don't even know if that exists in Vista/7. I've had such a nightmare with multiple boot partitions in the past, so I'm a bit wary of screwing up my machine - I've got it running loverly at the moment. Should probably just get myself some second hand piece of junk and let Bill Gates & co. loose on that.

The Luddite

Wrote something here? To have a post removed or your name hidden, write to [email protected].

Before your first post

A few rules keep this a friendly place. You agree to them once.

Shown next to what you post, here and in the app. It doesn’t have to be your real name: 3–24 lower-case letters, digits or _ (capitals become lower case, spaces become _).

    Then your post goes up straight away.

    Delete this reply?

    Open it in SynthMaker?

    It goes on the track you’re editing there, in place of that track’s sound, and into My sounds. Your other tracks stay as they are.

    Want to keep that track’s sound? Start a new song in SynthMaker first (Song › New song), then open this.

    Report this reply?

    Only the developer reads reports. The person isn’t told who reported them.

    What’s wrong with it?

    Block this person?

    You won’t see their posts and replies here any more. They aren’t told, and you can unblock them at any time.

    People you’ve blocked

    Their posts and replies are hidden from you. Unblock someone to see them again.

    The community rules

    A few rules keep this a friendly place. Everyone agrees to them once, before their first post.