Windows debug builds now really shouldn't associate themselves.

Also some (preliminary, untested, possibly bad) file type registration code for Mac.

Originally committed to SVN as r1068.
This commit is contained in:
Niels Martin Hansen 2007-04-13 01:54:47 +00:00
parent 0ef48599e6
commit d342a55418

View file

@ -265,13 +265,12 @@ int AegisubApp::OnRun() {
///////////////////////////////// /////////////////////////////////
// Registry program to filetypes // Registry program to filetypes
void AegisubApp::RegistryAssociate () { void AegisubApp::RegistryAssociate () {
#ifdef __WINDOWS__ #if defined(__WINDOWS__)
// Command to open with this // Command to open with this
wxString command; wxString command;
command << _T("\"") << fullPath << _T("\" \"%1\""); command << _T("\"") << fullPath << _T("\" \"%1\"");
// Main program association // Main program association
#ifndef DEBUG
wxRegKey *key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\Aegisub")); wxRegKey *key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\Aegisub"));
if (!key->Exists()) key->Create(); if (!key->Exists()) key->Create();
key->SetValue(_T(""),_T("Aegisub Subtitle Script")); key->SetValue(_T(""),_T("Aegisub Subtitle Script"));
@ -292,7 +291,6 @@ void AegisubApp::RegistryAssociate () {
if (!key->Exists()) key->Create(); if (!key->Exists()) key->Create();
key->SetValue(_T(""),command); key->SetValue(_T(""),command);
delete key; delete key;
#endif
// Check associations // Check associations
if (Options.AsBool(_T("Show associations"))) { if (Options.AsBool(_T("Show associations"))) {
@ -304,6 +302,15 @@ void AegisubApp::RegistryAssociate () {
Options.Save(); Options.Save();
} }
} }
#elif defined(__APPLE__)
// This is totally untested and pure guesswork
// I don't know if it should be ".ass" or just "ass"
wxFileName::MacRegisterDefaultTypeAndCreator(_T(".ass"), 0x41535341 /*ASSA*/, 0x41475355 /*AGSU*/);
// Technically .ssa isn't ASSA but it makes it so much easier ;)
wxFileName::MacRegisterDefaultTypeAndCreator(_T(".ssa"), 0x53534134 /*SSA4*/, 0x41475355 /*AGSU*/);
// Not touching .srt yet, there might be some type already registered for it which we should probably use then
#else
// Is there anything like this for other POSIX compatible systems?
#endif #endif
} }