1 /*!******************************************************************** 2 3 Audacity: A Digital Audio Editor 4 5 @file SelectFile.h 6 7 Paul Licameli split from FileNames.h 8 9 **********************************************************************/ 10 11 #ifndef __AUDACITY_SELECT_FILE__ 12 #define __AUDACITY_SELECT_FILE__ 13 14 #include "Identifier.h" // for FilePath 15 #include <vector> 16 class wxWindow; 17 18 class TranslatableString; 19 namespace FileNames { 20 enum class Operation; 21 struct FileType; 22 } 23 using FileTypes = std::vector< FileNames::FileType >; 24 25 AUDACITY_DLL_API FilePath 26 SelectFile(FileNames::Operation op, // op matters only when default_path is empty 27 const TranslatableString& message, 28 const FilePath& default_path, 29 const FilePath& default_filename, 30 const FileExtension& default_extension, 31 const FileTypes& fileTypes, 32 int flags, 33 wxWindow *parent); 34 35 /** \brief Protect against Unicode to multi-byte conversion failures 36 * on Windows */ 37 #if defined(__WXMSW__) 38 AUDACITY_DLL_API char *VerifyFilename(const wxString &s, bool input = true); 39 #endif 40 41 // Use this macro to wrap all filenames and pathnames that get 42 // passed directly to a system call, like opening a file, creating 43 // a directory, checking to see that a file exists, etc... 44 #if defined(__WXMSW__) 45 // Note, on Windows we don't define an OSFILENAME() to prevent accidental use. 46 // See VerifyFilename() for an explanation. 47 #define OSINPUT(X) VerifyFilename(X, true) 48 #define OSOUTPUT(X) VerifyFilename(X, false) 49 #elif defined(__WXMAC__) 50 #define OSFILENAME(X) ((char *) (const char *)(X).fn_str()) 51 #define OSINPUT(X) OSFILENAME(X) 52 #define OSOUTPUT(X) OSFILENAME(X) 53 #else 54 #define OSFILENAME(X) ((char *) (const char *)(X).mb_str()) 55 #define OSINPUT(X) OSFILENAME(X) 56 #define OSOUTPUT(X) OSFILENAME(X) 57 #endif 58 59 #endif 60