Bug 666 - Mac: Cannot "Open" audio files named with "\" using File>Open
This commit is contained in:
parent
b4a0be99cd
commit
0123a3e3fb
|
@ -44,22 +44,3 @@ const FilePath &PlatformCompatibility::GetExecutablePath()
|
|||
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
|
||||
//
|
||||
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
|
||||
|
|
|
@ -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
|
||||
// occasions (e.g. stuff like "C:\PROGRA~1\AUDACI~1\PROJEC~1.AUP"). We
|
||||
// convert these to long file name first.
|
||||
auto fileName = PlatformCompatibility::ConvertSlashInFileName(
|
||||
PlatformCompatibility::GetLongFileName(fileNameArg));
|
||||
auto fileName = PlatformCompatibility::GetLongFileName(fileNameArg);
|
||||
|
||||
if (TempDirectory::FATFilesystemDenied(fileName,
|
||||
XO("Project resides on FAT formatted drive.\n"
|
||||
|
@ -889,6 +888,7 @@ void ProjectFileManager::OpenFile(const FilePath &fileNameArg, bool addtohistory
|
|||
return;
|
||||
}
|
||||
|
||||
printf("fileexists %d\n", wxFileExists(fileName));
|
||||
if (!::wxFileExists(fileName)) {
|
||||
AudacityMessageBox(
|
||||
XO("Could not open file: %s").Format( fileName ),
|
||||
|
|
Loading…
Reference in New Issue