mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-23 17:30:17 +01:00
Bug 666 - Mac: Cannot "Open" audio files named with "\" using File>Open
This commit is contained in:
@@ -44,22 +44,3 @@ const FilePath &PlatformCompatibility::GetExecutablePath()
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
FilePath PlatformCompatibility::ConvertSlashInFileName(const FilePath &filePath)
|
|
||||||
{
|
|
||||||
#ifdef __WXMAC__
|
|
||||||
wxString path = filePath;
|
|
||||||
wxString filename;
|
|
||||||
wxString newPath = filePath;
|
|
||||||
// int pathLen = 1;
|
|
||||||
while (!wxDirExists(wxPathOnly(newPath)) && ! path.empty()) {
|
|
||||||
path = newPath.BeforeLast('/');
|
|
||||||
filename = newPath.AfterLast('/');
|
|
||||||
newPath = path;
|
|
||||||
newPath += ':';
|
|
||||||
newPath += filename;
|
|
||||||
}
|
|
||||||
return newPath;
|
|
||||||
#else
|
|
||||||
return filePath;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -39,19 +39,6 @@ public:
|
|||||||
// This string is unchanging
|
// This string is unchanging
|
||||||
//
|
//
|
||||||
static const FilePath &GetExecutablePath();
|
static const FilePath &GetExecutablePath();
|
||||||
|
|
||||||
//
|
|
||||||
// Audacity treats the / as a file separator always for Mac OS,
|
|
||||||
// however /'s are allowed in the filename. In order for /'s to
|
|
||||||
// work they muse be treated as :'s. To facilitate this, this
|
|
||||||
// function should be called when opening or saving a file on
|
|
||||||
// the Mac. It's important to note that if a / is used in a filename
|
|
||||||
// and folder exists in the same folder with the same name as the part
|
|
||||||
// of the file (before the first /) then the file will be saved inside
|
|
||||||
// of that directory. This function also exists in the FileDialogPrivate
|
|
||||||
// object
|
|
||||||
//
|
|
||||||
static FilePath ConvertSlashInFileName(const FilePath& filePath);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -855,8 +855,7 @@ void ProjectFileManager::OpenFile(const FilePath &fileNameArg, bool addtohistory
|
|||||||
// On Win32, we may be given a short (DOS-compatible) file name on rare
|
// On Win32, we may be given a short (DOS-compatible) file name on rare
|
||||||
// occasions (e.g. stuff like "C:\PROGRA~1\AUDACI~1\PROJEC~1.AUP"). We
|
// occasions (e.g. stuff like "C:\PROGRA~1\AUDACI~1\PROJEC~1.AUP"). We
|
||||||
// convert these to long file name first.
|
// convert these to long file name first.
|
||||||
auto fileName = PlatformCompatibility::ConvertSlashInFileName(
|
auto fileName = PlatformCompatibility::GetLongFileName(fileNameArg);
|
||||||
PlatformCompatibility::GetLongFileName(fileNameArg));
|
|
||||||
|
|
||||||
if (TempDirectory::FATFilesystemDenied(fileName,
|
if (TempDirectory::FATFilesystemDenied(fileName,
|
||||||
XO("Project resides on FAT formatted drive.\n"
|
XO("Project resides on FAT formatted drive.\n"
|
||||||
@@ -889,6 +888,7 @@ void ProjectFileManager::OpenFile(const FilePath &fileNameArg, bool addtohistory
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("fileexists %d\n", wxFileExists(fileName));
|
||||||
if (!::wxFileExists(fileName)) {
|
if (!::wxFileExists(fileName)) {
|
||||||
AudacityMessageBox(
|
AudacityMessageBox(
|
||||||
XO("Could not open file: %s").Format( fileName ),
|
XO("Could not open file: %s").Format( fileName ),
|
||||||
|
|||||||
Reference in New Issue
Block a user