Registering .blend files now works for Windows -- hopefully!

You will need to re-register the blend files (blender.exe -R)
for the fix to come into action.
This commit is contained in:
Simon Clitherow 2003-06-04 21:22:57 +00:00
parent f289109228
commit f40d9f57ee
2 changed files with 11 additions and 12 deletions

@ -57,11 +57,11 @@ int BLI_getInstallationDir( char * str ) {
size = sizeof(buffer);
lresult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\BlenderFoundation", 0,
lresult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\BlenderFoundation\\Blender", 0,
KEY_ALL_ACCESS, &hkey);
if (lresult == ERROR_SUCCESS) {
lresult = RegQueryValueEx(hkey, "Install_Dir", 0, NULL, (LPBYTE)buffer, &size);
lresult = RegQueryValueEx(hkey, "Inst_Dir", 0, NULL, (LPBYTE)buffer, &size);
strcpy(str, buffer);
RegCloseKey(hkey);
return 1;
@ -82,12 +82,11 @@ void RegisterBlendExtension(char * str) {
strncpy(dir, str, strlen(str)-11);
lresult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\BlenderFoundation", 0,
lresult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\BlenderFoundation\\Blender", 0,
"", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
if (lresult == ERROR_SUCCESS) {
if (dwd != REG_OPENED_EXISTING_KEY)
lresult = RegSetValueEx(hkey, "Install_Dir", 0, REG_SZ, dir, strlen(dir)+1);
lresult = RegSetValueEx(hkey, "Inst_Dir", 0, REG_SZ, dir, strlen(dir)+1);
RegCloseKey(hkey);
}

@ -407,6 +407,7 @@ int main(int argc, char **argv)
* - "-d": enables debugging.
* - "-w": fullscreen mode.
* - "-W": borderless window (MS windows only).
* - "-R": registers the blender extensions. (MS windows only).
* - "-noaudion", "-nosound": disables audio.
* - "-nofrozen": disables frozen python.
*/
@ -457,6 +458,12 @@ int main(int argc, char **argv)
/* XXX, fixme zr, borderless on win32 */
#ifdef _WIN32 // FULLSCREEN
G.windowstate = G_WINDOWSTATE_FULLSCREEN;
#endif
break;
case 'R':
/* Registering filetypes only makes sense on windows... */
#ifdef WIN32
RegisterBlendExtension(argv[0]);
#endif
break;
case 'n':
@ -545,7 +552,6 @@ int main(int argc, char **argv)
* - "-S": sets the starting scene name.
* - "-s": sets the start frame.
* - "-e": sets the end frame.
* - "-R": registers the blender extensions. (MS windows only)
* - <file>: sets the blender file to open.
*/
for(a=1; a<argc; a++) {
@ -641,12 +647,6 @@ int main(int argc, char **argv)
if (a < argc) (G.scene->r.efra) = atoi(argv[a]);
}
break;
case 'R':
/* Registering filetypes only makes sense on windows... */
#ifdef WIN32
RegisterBlendExtension(argv[0]);
#endif
break;
}
}
/**