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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-04-11 18:13:20 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-04-11 18:13:20 +0400
commit4d7db8e59e02bc7281e54222a9e169719b183121 (patch)
tree5c882149ec90ea62639c17a48127f0ffd320888f /source/blender/blenlib/intern/storage.c
parentdaaca806641331c38002541233ef3d3e3289ea4b (diff)
Fix #34929: windows would show a "No disk in drive" error popup when one of the recently opened files was on a DVD that's no longer there in the DVD drive.
Diffstat (limited to 'source/blender/blenlib/intern/storage.c')
-rw-r--r--source/blender/blenlib/intern/storage.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index 71cd5e529a2..3665b957c41 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -512,13 +512,24 @@ int BLI_exists(const char *name)
* don't mess with the argument name directly here - elubie */
wchar_t *tmp_16 = alloc_utf16_from_8(name, 0);
int len, res;
+ unsigned int old_error_mode;
+
len = wcslen(tmp_16);
- if (len > 3 && (tmp_16[len - 1] == L'\\' || tmp_16[len - 1] == L'/') ) tmp_16[len - 1] = '\0';
+ if (len > 3 && (tmp_16[len - 1] == L'\\' || tmp_16[len - 1] == L'/') )
+ tmp_16[len - 1] = '\0';
+
+ /* change error mode so user does not get a "no disk in drive" popup
+ * when looking for a file on an empty CD/DVD drive */
+ old_error_mode = SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX);
+
#ifndef __MINGW32__
res = _wstat(tmp_16, &st);
#else
res = _wstati64(tmp_16, &st);
#endif
+
+ SetErrorMode(old_error_mode);
+
free(tmp_16);
if (res == -1) return(0);
#else