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 <brecht@blender.org>2020-08-26 16:50:48 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-08-26 20:26:38 +0300
commitf699ba3d30ec1a5cb8d61f7522787a7b701ea9d2 (patch)
tree9e2d3c10e788f1eec685002ba87ecd28b7c7ff5e /source/blender/blenlib/intern/winstuff.c
parent9de18c361bb4efa11016b6a6671b6409cfe5a2fb (diff)
Cleanup: better naming and no bad level access in BLI_winstuff
Diffstat (limited to 'source/blender/blenlib/intern/winstuff.c')
-rw-r--r--source/blender/blenlib/intern/winstuff.c52
1 files changed, 13 insertions, 39 deletions
diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c
index df7e7107d11..333b6783087 100644
--- a/source/blender/blenlib/intern/winstuff.c
+++ b/source/blender/blenlib/intern/winstuff.c
@@ -36,14 +36,12 @@
# include "BLI_utildefines.h"
# include "BLI_winstuff.h"
-# include "../blenkernel/BKE_global.h" /* G.background, bad level include (no function calls) */
-
# include "utf_winfunc.h"
# include "utfconv.h"
/* FILE_MAXDIR + FILE_MAXFILE */
-int BLI_getInstallationDir(char *str)
+int BLI_windows_get_executable_dir(char *str)
{
char dir[FILE_MAXDIR];
int a;
@@ -60,19 +58,19 @@ int BLI_getInstallationDir(char *str)
return 1;
}
-static void RegisterBlendExtension_Fail(HKEY root)
+static void register_blend_extension_failed(HKEY root, const bool background)
{
printf("failed\n");
if (root) {
RegCloseKey(root);
}
- if (!G.background) {
+ if (!background) {
MessageBox(0, "Could not register file extension.", "Blender error", MB_OK | MB_ICONERROR);
}
TerminateProcess(GetCurrentProcess(), 1);
}
-void RegisterBlendExtension(void)
+void BLI_windows_register_blend_extension(const bool background)
{
LONG lresult;
HKEY hkey = 0;
@@ -108,7 +106,7 @@ void RegisterBlendExtension(void)
usr_mode = true;
lresult = RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Classes", 0, KEY_ALL_ACCESS, &root);
if (lresult != ERROR_SUCCESS) {
- RegisterBlendExtension_Fail(0);
+ register_blend_extension_failed(0, background);
}
}
@@ -120,7 +118,7 @@ void RegisterBlendExtension(void)
RegCloseKey(hkey);
}
if (lresult != ERROR_SUCCESS) {
- RegisterBlendExtension_Fail(root);
+ register_blend_extension_failed(root, background);
}
lresult = RegCreateKeyEx(root,
@@ -138,7 +136,7 @@ void RegisterBlendExtension(void)
RegCloseKey(hkey);
}
if (lresult != ERROR_SUCCESS) {
- RegisterBlendExtension_Fail(root);
+ register_blend_extension_failed(root, background);
}
lresult = RegCreateKeyEx(root,
@@ -156,7 +154,7 @@ void RegisterBlendExtension(void)
RegCloseKey(hkey);
}
if (lresult != ERROR_SUCCESS) {
- RegisterBlendExtension_Fail(root);
+ register_blend_extension_failed(root, background);
}
lresult = RegCreateKeyEx(
@@ -167,10 +165,10 @@ void RegisterBlendExtension(void)
RegCloseKey(hkey);
}
if (lresult != ERROR_SUCCESS) {
- RegisterBlendExtension_Fail(root);
+ register_blend_extension_failed(root, background);
}
- BLI_getInstallationDir(InstallDir);
+ BLI_windows_get_executable_dir(InstallDir);
GetSystemDirectory(SysDir, FILE_MAXDIR);
ThumbHandlerDLL = "BlendThumb.dll";
snprintf(
@@ -179,7 +177,7 @@ void RegisterBlendExtension(void)
RegCloseKey(root);
printf("success (%s)\n", usr_mode ? "user" : "system");
- if (!G.background) {
+ if (!background) {
sprintf(MBox,
"File extension registered for %s.",
usr_mode ? "the current user. To register for all users, run as an administrator" :
@@ -189,7 +187,7 @@ void RegisterBlendExtension(void)
TerminateProcess(GetCurrentProcess(), 0);
}
-void get_default_root(char *root)
+void BLI_windows_get_default_root_dir(char *root)
{
char str[MAX_PATH + 1];
@@ -236,7 +234,7 @@ void get_default_root(char *root)
}
}
if (0 == rc) {
- printf("ERROR in 'get_default_root': can't find a valid drive!\n");
+ printf("ERROR in 'BLI_windows_get_default_root_dir': can't find a valid drive!\n");
root[0] = 'C';
root[1] = ':';
root[2] = '\\';
@@ -246,30 +244,6 @@ void get_default_root(char *root)
}
}
-/* UNUSED */
-# if 0
-int check_file_chars(char *filename)
-{
- char *p = filename;
- while (*p) {
- switch (*p) {
- case ':':
- case '?':
- case '*':
- case '|':
- case '\\':
- case '/':
- case '\"':
- return 0;
- break;
- }
-
- p++;
- }
- return 1;
-}
-# endif
-
#else
/* intentionally empty for UNIX */