Accessing Tracktion default directory X-Platform


#1

Hey jules…

how would one get the default tracktion directory via jule? any clues? I’ve got a colorscheme reader for this little tool, and I’d like it to know where to get the default scheme automatically.

w00t! :slight_smile:


#2

But the colour schemes are all munged into the executable - you can’t read them externally…? Or have I misunderstood what you’re doing?


#3

have you forgotten how it’s done jules? :smiley: the current colourscheme settings are stored in the .trksettings file :smiley:


#4

oh those colourschemes!

Well if it’s in the tracktion app directory, I don’t think there’s any easy way of finding that without doing horrible registry stuff. You’d have to look up the registry entries that say which app to start for a tracktion file extension. Ugh.


#5

you can always ask the user to select the folder


#6

okee… thanks… looks like I’ll have to let the user select.


#7

i’d presume the plug to be in the tracktion2\plugins folder, therefore it should be able to access the .trksettings file from the parent folder. if it’s not found there, then it could ask the user to specify the location. perhaps it could even check the parent of the parent just in case? i don’t know how the mac directories are structured tho, but i don’t see it too much of a porting issue to change a single path checking function :slight_smile:


#8

here is how I resolved it with no registry hacking…

tracktionPath = File::getCurrentApplicationFile().getFullPathName();
tracktionPath = tracktionPath.dropLastCharacters(13);
tracktionPath.append( T("CurrentUserSettings.trksettings"),32);

HaX0rz! hahah :smiley:


#9

ingenious! :smiley: well done mod


#10

oh, Mod, please - that’s grotesque! Let’s set a good example to any newbie programmers who may be reading this, by using

File::getCurrentApplicationFile().getParentDirectory().getSiblingFile (T(“CurrentUserSettings.trksettings”))

instead!

Golden rule: never manipulate filenames as strings!


#11

even better! :smiley: :smiley: :smiley:

i can see that’s a much better way of doing it. i presume it’s a golden rule tho to ensure that any path structures are definite? otherwise they’re just scattered characters waiting to be reparsed with chance for being wrong somewhere along the line…

constantly learning stuff from this ‘jules’ fella :hihi:


#12

[quote=“jules”]oh, Mod, please - that’s grotesque! Let’s set a good example to any newbie programmers who may be reading this, by using

File::getCurrentApplicationFile().getParentDirectory().getSiblingFile (T(“CurrentUserSettings.trksettings”))

instead!

Golden rule: never manipulate filenames as strings![/quote]

well that all you had to say in the first place! sheesh! I thought getsibling() might force my brother to drive down to my way… didin’t want to inconvenice him at such a late hour. :lol: thanks for the tip jules, you know how much I love horrid code. :shock: I’ll go sit in the corner now with a bar of soap in my mouth for all the dirty talk. :lol:

wait… now what about on the mac? or is it pretty safe to assume everything goes in ($HOME)/Library/Cache/Tracktion?


#13

glad you’re taking your criticism like a man!

yes, the mac’s a bit different, I think it’s pretty safe to assumes it’s in the library/cache folder. You can use File (T("~/Library/Cache/Tracktion")) to get the folder - juce will parse the ~ properly.


#14

you know what really sucks… I’ve started spelling color, colour… bastard! :wink:


#15

Jules! World domination gets ever closer! :hihi:

Colour is the way it REALLY is. spell it like a MAN!


#16

re Color/Colour

When I was in first year I handed in a Java coursework that was perfection. Apart from a comment about why I should not be spelling “Colour” like “Color” in my comments just because Java/America does! Nit-picking cunts.


#17