MeVisLab Toolbox Reference
macFileManager.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2007, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #ifndef MAC_FILE_MANAGER_H
14 #define MAC_FILE_MANAGER_H
15 
17 
18 #if defined(__APPLE__)
19 
21 #include <string>
22 
23 namespace macos {
24 
27  {
28  public:
29 
31  enum FMFolderType {
32  // Local folder (All users of a single machine have access to these resources)
33  LocalApplicationSupportFolder = 0x000,
36 
37  // User folder (Read/write resources that are private to the user)
38  UserDocumentsFolder = 0x100,
44  };
45 
47  static std::string locateFolder(FMFolderType type);
48 
50  static std::string getUserTemporaryItemsFolder();
51 
53  static bool isFilePackageAtPath(const std::string &path);
54 
56 
59  static bool moveItemToTrash(const std::string &file, bool hidden = true);
60 
62 
64  static bool authorizeAndCopyItem(const std::string &src, const std::string &dst);
65 
67 
69  static bool authorizeAndInstallItem(const std::string &src, const std::string &dst);
70 
73  static bool showItemInFileSystemBrowser(const std::string &file);
74 
76  static std::string getItemUTI(const std::string &path);
77 
79  static bool itemConformsToUTI(const std::string &path, const std::string &uti);
80  };
81 
82 }
83 
84 #endif // __APPLE__
85 #endif // __macFileManager_H
File operations.
static bool showItemInFileSystemBrowser(const std::string &file)
Activates the Finder and opens one window selecting the specified item.
FMFolderType
Specifies the different folder types.
@ UserCachesFolderType
Specifies the Caches folder (location of discardable cache files)
@ UserPreferencesFolderType
Specifies the Preferences folder.
@ UserDesktopFolder
Specifies the Desktop folder.
@ UserApplicationSupportFolder
Specifies the Application Support folder. This folder contains code and data files needed by third-pa...
@ LocalCachesFolderType
Specifies the Caches folder (location of discardable cache files)
@ LocalPreferencesFolderType
Specifies the Preferences folder.
@ UserDownloadsFolder
Specifies the Downloads folder.
static bool authorizeAndInstallItem(const std::string &src, const std::string &dst)
Request authorization to elevate privileges and install item (UTF8)
static bool isFilePackageAtPath(const std::string &path)
Determines whether the specified path points to a file package (UTF8)
static bool authorizeAndCopyItem(const std::string &src, const std::string &dst)
Request authorization to elevate privileges and copy item (UTF8, macOS 10.14)
static std::string locateFolder(FMFolderType type)
Obtains location information for system-related directories (UTF8)
static bool itemConformsToUTI(const std::string &path, const std::string &uti)
Returns 'true' if the given filesystem item conforms to the specified Uniform Type Identifier (UTI)
static bool moveItemToTrash(const std::string &file, bool hidden=true)
The item is moved to the trash folder on the volume containing the item. Returns 'true' if successful...
static std::string getUserTemporaryItemsFolder()
Returns the path of the temporary directory for the current user (UTF8)
static std::string getItemUTI(const std::string &path)
Returns the Uniform Type Identifier (UTI) of this filesystem item or an empty string (UTF8)
#define OSXSUPPORT_PUBLIC_API
Symbol visibility macros.
AppleScript support.