THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 30/04/2008 at 16:40, xxxxxxxx wrote:
Cinema 4D Version: R9-R10.5
Platform: Windows ; Mac ; Mac OSX ;
Language(s) : C++ ;
I have a user using my plugin on Windows Vista. He seems to be having access rights issues because my data files are in the "Program Files" folder (in my plugin folder more exactly). He recommends putting the data files in some "user" folder (whether or not this should be the "All Users" folder under "Documents and Settings" is beyond me - a little vague on the details he is). Not having Vista I don't know what differences exist and there is no way for me to test the issue or the efficacy of a solution.
So, before you leave, Matthias, can you provide any information? I see that Cinema 4D prefs are loaded quite readily. Do I need to do something to appease Vista? Why would these files cause access problems? Do I need to set some attribute on the file (and how would that be accomplished)?
On 01/05/2008 at 06:32, xxxxxxxx wrote:
Under Vista file access rights are limited to read-only if the programm is under the "Program Files" folder. We are facing the same problems and working on a solution for this for future Cinema4D versions. Does your plugin write files in its own directory? If so you may need to move these files outside of the "Program Files" directory. Usally programs should use the user application folder.
That's all I can say so far til I am back to work again.
On 01/05/2008 at 17:01, xxxxxxxx wrote:
Yes, my plugin reads/writes preferences, logs, and some other data into its own directory where installed.
I see that there are two potential places to put my plugin data files on Vista:
Although ProgramData is a 'shared' application data storage (all users of the computer can access it), using this would probably be less hassle than employing Windows API calls to find <username>.
Now the problem is determining %systemdrive%. GetSystemEnvironmentVariable() may be useful here. I did Java development to avoid OS-dependent API calls. And I didn't mind doing C4D plugin development for similar reasons - although I have had to make some OS API calls on MacOSX to get at file resources. I don't see a C4D SDK call that would retrieve the system drive where Windows is installed. I also have no idea how to determine which version of Windows is being used without employing OS API calls.
Since Matthias is going to be away for a while, please, anyone respond with useful information regarding this.
On 02/05/2008 at 00:29, xxxxxxxx wrote:
Okay. GetSystemEnvironmentVariable("UserProfile", result) works here. Using result.FindFirst("\\users\",..) (after doing a ToLower()) is enough to determine that this is Vista. I do a (GeGetCurrentOS() == OS_WIN) before that for clarity and brevity.
After that is all validated (Windows, Vista), I can check for the existence of/create the necessary folders in the current user's folder in which to store the data and use that path instead of GeGetPluginPath() to get at them.
It was a bit of work since GeGetPluginPath() is global whereas I needed to store the alternative (and the default for other systems) somewhere accessible to a myriad set of classes.
On 02/05/2008 at 12:28, xxxxxxxx wrote:
You might want to look at and think about Get/SetWorldPluginData()... might simplify some things (you could even allocate some new IDs just for that use). Though that wouldn't likely be useful for log-files, but you 'could' use it to store the folder/path, if not all the other data/preferences.