mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-21 14:02:57 +02:00
Locate and position the current Audacity source code, and clear a variety of old junk out of the way into junk-branches
This commit is contained in:
72
src/PlatformCompatibility.cpp
Normal file
72
src/PlatformCompatibility.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
PlatformCompatibility.cpp
|
||||
|
||||
Markus Meyer
|
||||
|
||||
*******************************************************************//*!
|
||||
|
||||
\class PlatformCompatibility
|
||||
\brief Filename Compatibility utilities.
|
||||
|
||||
\see FileNames
|
||||
|
||||
*//*******************************************************************/
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <wx/filefn.h>
|
||||
#include <wx/filename.h>
|
||||
#include <wx/stdpaths.h>
|
||||
#include <wx/app.h>
|
||||
|
||||
#include "AudacityApp.h"
|
||||
#include "PlatformCompatibility.h"
|
||||
|
||||
wxString PlatformCompatibility::GetLongFileName(const wxString& shortFileName)
|
||||
{
|
||||
wxFileName fn(shortFileName);
|
||||
|
||||
return fn.GetLongPath();
|
||||
}
|
||||
|
||||
wxString PlatformCompatibility::GetExecutablePath()
|
||||
{
|
||||
static bool found = false;
|
||||
static wxString path;
|
||||
|
||||
if (!found) {
|
||||
wxStandardPaths std;
|
||||
|
||||
path = std.GetExecutablePath();
|
||||
|
||||
found = true;
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
wxString PlatformCompatibility::ConvertSlashInFileName(const wxString& filePath)
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
wxString path = filePath;
|
||||
wxString filename;
|
||||
wxString newPath = filePath;
|
||||
int pathLen = 1;
|
||||
while (!wxDirExists(wxPathOnly(newPath)) && ! path.IsEmpty()) {
|
||||
path = newPath.BeforeLast('/');
|
||||
filename = newPath.AfterLast('/');
|
||||
newPath = path;
|
||||
newPath += ':';
|
||||
newPath += filename;
|
||||
}
|
||||
return newPath;
|
||||
#else
|
||||
return filePath;
|
||||
#endif
|
||||
}
|
Reference in New Issue
Block a user