diff options
author | David Kocik <kocikdav@gmail.com> | 2019-11-26 16:19:29 +0300 |
---|---|---|
committer | David Kocik <kocikdav@gmail.com> | 2019-12-13 15:51:45 +0300 |
commit | 8b4732e811fcca736c6e8a78b1d03c441d30ea2c (patch) | |
tree | a2da7e10b665f834d1507191aa60d2e187cefca5 /src/slic3r/GUI/RemovableDriveManager.hpp | |
parent | 62e36cd2d5f96c2abcdbc68cc4816a1a3e2a803b (diff) |
removable drive manager - Windows part
Diffstat (limited to 'src/slic3r/GUI/RemovableDriveManager.hpp')
-rw-r--r-- | src/slic3r/GUI/RemovableDriveManager.hpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/slic3r/GUI/RemovableDriveManager.hpp b/src/slic3r/GUI/RemovableDriveManager.hpp new file mode 100644 index 000000000..cab58fee6 --- /dev/null +++ b/src/slic3r/GUI/RemovableDriveManager.hpp @@ -0,0 +1,41 @@ +#ifndef slic3r_GUI_RemovableDriveManager_hpp_ +#define slic3r_GUI_RemovableDriveManager_hpp_ + +#include <vector> +#include <string> + +namespace Slic3r { +namespace GUI { +struct DriveData +{ + std::wstring name; + std::string path; + DriveData(std::wstring n, std::string p):name(n),path(p){} +}; +class RemovableDriveManager +{ +public: + static RemovableDriveManager& getInstance() + { + static RemovableDriveManager instance; + return instance; + } + RemovableDriveManager(RemovableDriveManager const&) = delete; + void operator=(RemovableDriveManager const&) = delete; + + //update() searches for removable devices, returns false if empty. + static bool update(); + static bool isDriveMounted(std::string path); + static void ejectDrive(std::string path); + static std::string getLastDrivePath(); + static void getAllDrives(std::vector<DriveData>& drives); +private: + RemovableDriveManager(){} + static void searchForDrives(std::vector<DriveData>& newDrives); + static void printDrivesToLog(); + static void updateCurrentDrives(const std::vector<DriveData>& newDrives); + static std::vector<DriveData> currentDrives; + +}; +}} +#endif
\ No newline at end of file |