Special Folders in Linux


#1

Jules,

there seem to be some folders in Linux that an app can’t write to, whereas the special folders seems to suggest there are. The fopen fails, and then juce fails to create/open the file, with no feedback. The first time there’s a clue is when the first write operation fails.

Please could you work something out? Maybe pick folders that a normal app can access, or maybe an assertion, or even some waring when a file open fails?

Thanks,

Bruce


#2

Which ones did you have in mind? Surely most of those folders are just in the user’s home dir?


#3

On other platforms, I was writing a log to commonApplicationDataDirectory. That was failing to open a file, but not really giving me a clue until the logstream creates - or not. Possibly globalApplicationsDirectory and tempDirectory will having the same problem, not being in the users’s path?

Bruce


#4

Well if it’s a common folder, that doesn’t guarantee it’s writable, on any platform… If you really need to be able to write to it, you should put it in the user’s home somewhere.


#5

Yes, but that differs by platform, and more to the point, there’s no warning. Maybe you could just add an assert if a file open fails because of permissions?

I know it know, but as more people move apps to Linux, I’m sure it’ll come up. It’s an area where the same code doesn’t do the same on different platforms in juce, and those are astonishingly rare.

Bruce


#6

Hmm, but it might get a bit annoying to get an assertion every time a file open fails. Often you might have code where it’s expected for it to fail sometimes.


#7

Well, it was a juce system log class. Maybe that sort of thing - an unattended built-in file, could warn? Just a suggestion.

Bruce


#8

true, for that kind of thing I guess it’d be useful.