Advanced Member David Walters Posted October 10, 2008 Advanced Member Report Share Posted October 10, 2008 Hi, I hope you don't mind me posting a code snippet, but I have solved this problem already and it's good to share, right My initial request is: Can you change 3d-Coat to read shaders from the user data folder as well as the installation directory? The code I've posted below will generate a valid path (on both XP and Vista) to the user's application data folder, either: C:\Users\%user%\AppData\Roaming (on Vista) or C:\Documents and Settings\%user%\Application Data\ (on XP) where you are free to read and write data without any access restrictions. The reason I ask is that, as you probably know, files written to the Program Files folder normally, actually end up being written instead to the "virtual store" ( C:\Users\%user%\AppData\Local\VirtualStore ) which can lead to a variety of problems with mismatches, etc. - as you can imagine. Ultimately I'd love to see all of the volatile data that 3d-Coat uses (undo, etc.) to use the user data folder: * Avoid the need for the UAC elevation on startup which looks a little bit unprofessional (sorry!) * Allow UNDO to live on a different disk, which might help people with a small C: partition and their user folder on some other drive? * Allow editing of shaders in this location without UAC interfering, this might help developers? * License data file can exist even when you uninstall, or install in a different directory? I've probably not explained myself very clearly and I can hopefully clarify what I mean, I found this quite a hard issue to explain I'm sure it probably doesn't seem like such a big thing either, but I think making an application that lives harmoniously with Vista is a good long term goal. char profile_folder[ MAX_PATH ]; if SUCCEEDED( SHGetFolderPath( NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, profile_folder ) ) { // Append company / title suffix strcat_s( profile_folder, sizeof( profile_folder ), "\\Pilgway\\3d-Coat\\" ); // Get the base length const size_t length = strlen( profile_folder ); // Create Directory Tree, skip drive for ( unsigned int i = 2; i < length; ++i ) { if ( profile_folder[ i ] == '\\' || profile_folder[ i ] == '/' ) { // Briefly turn into a NULL terminated c-string profile_folder[ i ] = NULL; _mkdir( profile_folder ); profile_folder[ i ] = '\\'; } } // Create home directory _mkdir( profile_folder ); // Debug printf( "home_path = %s\n", profile_folder ); } Quote Link to comment Share on other sites More sharing options...
Andrew Shpagin Posted October 11, 2008 Report Share Posted October 11, 2008 I agree, it is important. Just need to find some time. I have not still done your previous request... But I remember. Thank for piece of code. I hope I will use it some day. Quote Link to comment Share on other sites More sharing options...
Advanced Member David Walters Posted October 11, 2008 Author Advanced Member Report Share Posted October 11, 2008 Thanks! I can't imagine how long your wish list is already - you really are outnumbered by the people who love this software, and everyone wishes to see it grow! I'm sure you'll get there in the end! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.