diff options
author | Robin Gareus <robin@gareus.org> | 2019-06-12 21:34:39 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2019-06-12 21:35:07 +0200 |
commit | b37f30897dd7a032b97fe87b709c335f9d1cca9d (patch) | |
tree | 1e906ac5f6bf2609e10f8d6b05f39046f7a6cb03 /gtk2_ardour/sfdb_ui.cc | |
parent | 989480ab8447a0cd714d621ca12383fc7c27cbef (diff) |
Windows does in theory support hard-links
NB. this is just as unused as the POSIX link() test. Aardour
doesn't create hardlinks since version 3.0. At least it's now
consistently wrong on all platforms :)
Diffstat (limited to 'gtk2_ardour/sfdb_ui.cc')
-rw-r--r-- | gtk2_ardour/sfdb_ui.cc | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc index 67eda8914a..63b09ba3b8 100644 --- a/gtk2_ardour/sfdb_ui.cc +++ b/gtk2_ardour/sfdb_ui.cc @@ -21,6 +21,10 @@ #include "gtk2ardour-config.h" #endif +#ifdef PLATFORM_WINDOWS +#include <windows.h> +#endif + #include <map> #include <cerrno> #include <sstream> @@ -1696,9 +1700,6 @@ SoundFileOmega::check_info (const vector<string>& paths, bool& same_size, bool& bool SoundFileOmega::check_link_status (const Session* s, const vector<string>& paths) { -#ifdef PLATFORM_WINDOWS - return false; -#else std::string tmpdir(Glib::build_filename (s->session_directory().sound_path(), "linktest")); bool ret = false; @@ -1715,10 +1716,16 @@ SoundFileOmega::check_link_status (const Session* s, const vector<string>& paths snprintf (tmpc, sizeof(tmpc), "%s/%s", tmpdir.c_str(), Glib::path_get_basename (*i).c_str()); /* can we link ? */ - - if (link ((*i).c_str(), tmpc)) { +#ifdef PLATFORM_WINDOWS + /* see also ntfs_link -- msvc only pbd extension */ + if (false == CreateHardLinkA (/*new link*/ tmpc, /*existing file*/ (*i).c_str(), NULL)) { + goto out; + } +#else + if (link (/*existing file*/(*i).c_str(), tmpc)) { goto out; } +#endif ::g_unlink (tmpc); } @@ -1728,7 +1735,6 @@ SoundFileOmega::check_link_status (const Session* s, const vector<string>& paths out: g_rmdir (tmpdir.c_str()); return ret; -#endif } SoundFileChooser::SoundFileChooser (string title, ARDOUR::Session* s) |