Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Weikert <elubie@gmx.net>2007-02-28 23:11:10 +0300
committerAndrea Weikert <elubie@gmx.net>2007-02-28 23:11:10 +0300
commite53c5058b4cb386c6b3f63cec52750c2f6a1021b (patch)
treebdf7ec7990082c07b138c92bc2e8125a772c5c56 /source/blender/blenlib/intern/winstuff.c
parentb58d1f9ba05c56310a1067b25d502b84c7cd0021 (diff)
=== bugfix ===
filename and path issues: [ #6107 ] Animation crashes when ouput folder does not exist - using the Windows drive as default and only then degrading to the Blender installation drive and then the first valid drive. - in case of degrading added error message print to console to make it transparent [ #6106 ] fluids - no default path - setting the default path to U.tempdir where Blender stores temporary files
Diffstat (limited to 'source/blender/blenlib/intern/winstuff.c')
-rw-r--r--source/blender/blenlib/intern/winstuff.c60
1 files changed, 43 insertions, 17 deletions
diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c
index 6b861ad43df..1a3dfa79516 100644
--- a/source/blender/blenlib/intern/winstuff.c
+++ b/source/blender/blenlib/intern/winstuff.c
@@ -150,27 +150,53 @@ int closedir (DIR *dp) {
}
void get_default_root(char* root) {
- DWORD tmp;
- int i;
-
- tmp= GetLogicalDrives();
-
- for (i=2; i < 26; i++) {
- if ((tmp>>i) & 1) {
- root[0] = 'a'+i;
+ char str[MAX_PATH+1];
+
+ /* the default drive to resolve a directory without a specified drive
+ should be the Windows installation drive, since this was what the OS
+ assumes. */
+ if (GetWindowsDirectory(str,MAX_PATH+1)) {
+ root[0] = str[0];
+ root[1] = ':';
+ root[2] = '\\';
+ root[3] = '\0';
+ } else {
+ /* if GetWindowsDirectory fails, something has probably gone wrong,
+ we are trying the blender install dir though */
+ if (GetModuleFileName(NULL,str,MAX_PATH+1)) {
+ printf("Error! Could not get the Windows Directory - Defaulting to Blender installation Dir!");
+ root[0] = str[0];
root[1] = ':';
root[2] = '\\';
root[3] = '\0';
- if (GetFileAttributes(root) != 0xFFFFFFFF)
- return;
- }
+ } else {
+ DWORD tmp;
+ int i;
+ int rc = 0;
+ /* now something has gone really wrong - still trying our best guess */
+ printf("Error! Could not get the Windows Directory - Defaulting to first valid drive! Path might be invalid!");
+ tmp= GetLogicalDrives();
+ for (i=2; i < 26; i++) {
+ if ((tmp>>i) & 1) {
+ root[0] = 'a'+i;
+ root[1] = ':';
+ root[2] = '\\';
+ root[3] = '\0';
+ if (GetFileAttributes(root) != 0xFFFFFFFF) {
+ rc = i;
+ break;
+ }
+ }
+ }
+ if (0 == rc) {
+ printf("ERROR in 'get_default_root': can't find a valid drive!");
+ root[0] = 'C';
+ root[1] = ':';
+ root[2] = '\\';
+ root[3] = '\0';
+ }
+ }
}
-
- printf("ERROR in 'get_default_root': can't find a valid drive!");
- root[0] = 'c';
- root[1] = ':';
- root[2] = '\\';
- root[3] = '\0';
}
#else