Update of /cvsroot/audacity/audacity-src/src
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv18814/src
Modified Files:
FileNames.cpp PlatformCompatibility.cpp
Log Message:
Fix Portable Settings issue on OSX.
Utilize newer wx classes in PlatformCompatibility.cpp. (probably could get rid
of this now)
Index: FileNames.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/FileNames.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- FileNames.cpp 14 Oct 2008 18:05:16 -0000 1.16
+++ FileNames.cpp 9 Jan 2009 22:36:29 -0000 1.17
@@ -87,6 +87,12 @@
// executable's EXE file, the prefs are stored in there, otherwise
// the prefs are stored in the user data dir provided by the OS.
wxFileName exePath(PlatformCompatibility::GetExecutablePath());
+#if defined(__WXMAC__)
+ // This removes (for instance) "Audacity.app/Contents/MacOSX"
+ exePath.RemoveLastDir();
+ exePath.RemoveLastDir();
+ exePath.RemoveLastDir();
+#endif
wxFileName portablePrefsPath(exePath.GetPath(), wxT("Portable
Settings"));
if (::wxDirExists(portablePrefsPath.GetFullPath()))
Index: PlatformCompatibility.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/PlatformCompatibility.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- PlatformCompatibility.cpp 10 Mar 2008 22:20:18 -0000 1.12
+++ PlatformCompatibility.cpp 9 Jan 2009 22:36:29 -0000 1.13
@@ -25,120 +25,30 @@
#include <wx/stdpaths.h>
#include <wx/app.h>
-#ifdef __WXMAC__
-#include <wx/mac/private.h>
-#endif
-
#include "AudacityApp.h"
#include "PlatformCompatibility.h"
wxString PlatformCompatibility::GetLongFileName(const wxString& shortFileName)
{
-#ifndef _WIN32
-
- // On other platforms than Win32, this function is only a dummy
- return shortFileName;
-
-#else
-
- wxString stringLeft = shortFileName;
- wxString s;
- wxString longFileName;
-
- while (!stringLeft.IsEmpty())
- {
- // Get next path component
- int end = stringLeft.Find('\\');
-
- if (end == -1) {
- s = stringLeft;
- stringLeft.Empty();
- } else {
- s = stringLeft.Left(end);
- stringLeft = stringLeft.Mid(end + 1);
- }
-
- // Process it unless it is empty, or the drive name
- if (!(s.IsEmpty() || (s.Length() == 2 && s.GetChar(1) == ':')))
- {
- // Now resolve for _every_ path component the long file name.
- // The standard way (only resolve components with '~' in it) is not
- // enough, because the user may have NameNumericTail turned off.
- wxString pathToFind = longFileName + s;
- WIN32_FIND_DATA findData;
- HANDLE findHandle = FindFirstFile(pathToFind.fn_str(), &findData);
-
- if (findHandle != INVALID_HANDLE_VALUE)
- {
- s = findData.cFileName; // cFileName always contains long file name
- FindClose(findHandle);
- }
- }
-
- // Note that we must be careful here to prevent discarding any
- // backslashes. It could e.g. be a network name, too!
- longFileName += s;
- if (end != -1)
- longFileName += wxT("\\");
- }
-
- return longFileName;
+ wxFileName fn(shortFileName);
-#endif
+ return fn.GetLongPath();
}
-//
-// Taken from http://wxwidgets.org/docs/technote/install.htm
-//
wxString PlatformCompatibility::GetExecutablePath()
{
- static bool found = false;
- static wxString path;
-
- if (found)
- return path;
- else
- {
-#ifdef __WXMSW__
-
- wxChar buf[512];
- *buf = '\0';
- GetModuleFileName(NULL, buf, 511);
- path = buf;
-
-#elif defined(__WXMAC__)
-
- ProcessInfoRec processinfo;
- ProcessSerialNumber procno ;
- FSSpec fsSpec;
+ static bool found = false;
+ static wxString path;
- procno.highLongOfPSN = 0 ;
- procno.lowLongOfPSN = kCurrentProcess ;
- processinfo.processInfoLength = sizeof(ProcessInfoRec);
- processinfo.processName = NULL;
- processinfo.processAppSpec = &fsSpec;
+ if (!found) {
+ wxStandardPaths std;
- GetProcessInformation( &procno , &processinfo ) ;
- path = wxMacFSSpec2MacFilename(&fsSpec);
-#else
- wxString argv0 = wxGetApp().argv[0];
+ path = std.GetExecutablePath();
- if (wxIsAbsolutePath(argv0))
- path = argv0;
- else
- {
- wxPathList pathlist;
- pathlist.AddEnvList(wxT("PATH"));
- path = pathlist.FindAbsoluteValidPath(argv0);
- }
+ found = true;
+ }
- wxFileName filename(path);
- filename.Normalize();
- path = filename.GetFullPath();
-#endif
- found = true;
- return path;
- }
+ return path;
}
wxString PlatformCompatibility::ConvertSlashInFileName(const wxString&
filePath)
------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs