Re: Standard OCIO Directories


László Sebő <laszl...@...>
 

On Thu, Apr 12, 2012 at 1:51 PM, Brendan Bolles <bre...@...> wrote:
> My path suggestions:
> Mac: /Library/Application Support/OpenColorIO
> Windows: C:\Program Files\Common Files\OpenColorIO
> Linux: /usr/share/OpenColorIO


The only thing i would add to this is the windows folder location. The "program files" folders tend to be admin only access, so a better place could be maybe to use the common "app data" folders.

There are a couple of ways to get to it in a version / language agnostic way, the most reliable being:

#include "shlobj.h"

TCHAR szPath[MAX_PATH];
SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, 0, szPath);
wprintf(L"%s\n", szPath);

returning:
on win7: c:\ProgramData
on XP:  c:\Documents and Settings\All Users\Application Data

Other option is to use env variables, but thats not as good (you will see why):

%appdata%  :  local user's app data should go here
%allusersprofile%   :   shared user data   <-- this is probably preferred

on win7 these are:
appdata = c:\Users\<username>\AppData\Roaming
allusersprofile = c:\ProgramData    <-- matches what the winapi function returns

on XP these are:
appdata = c:\Documents and Settings\<username>\Application Data
allusersprofile = c:\Documents and Settings\All Users   <-- does not match the winapi function...

You might notice that on XP, the allusersprofile does not return an Application Data subfolder, but the root profile folder instead. The subfolder name is language dependent, so you cant even hardcode an additional "Application Data" in the name :\


Anyhow, the "common files" folder might be good as well, just probably would be non-editable in most cases.


cheers,
laszlo

Join ocio-dev@lists.aswf.io to automatically receive all group messages.