mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 15:25:01 +01:00
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 :)
This commit is contained in:
parent
989480ab84
commit
b37f30897d
1 changed files with 12 additions and 6 deletions
|
|
@ -21,6 +21,10 @@
|
||||||
#include "gtk2ardour-config.h"
|
#include "gtk2ardour-config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PLATFORM_WINDOWS
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
@ -1696,9 +1700,6 @@ SoundFileOmega::check_info (const vector<string>& paths, bool& same_size, bool&
|
||||||
bool
|
bool
|
||||||
SoundFileOmega::check_link_status (const Session* s, const vector<string>& paths)
|
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"));
|
std::string tmpdir(Glib::build_filename (s->session_directory().sound_path(), "linktest"));
|
||||||
bool ret = false;
|
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());
|
snprintf (tmpc, sizeof(tmpc), "%s/%s", tmpdir.c_str(), Glib::path_get_basename (*i).c_str());
|
||||||
|
|
||||||
/* can we link ? */
|
/* can we link ? */
|
||||||
|
#ifdef PLATFORM_WINDOWS
|
||||||
if (link ((*i).c_str(), tmpc)) {
|
/* see also ntfs_link -- msvc only pbd extension */
|
||||||
|
if (false == CreateHardLinkA (/*new link*/ tmpc, /*existing file*/ (*i).c_str(), NULL)) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (link (/*existing file*/(*i).c_str(), tmpc)) {
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
::g_unlink (tmpc);
|
::g_unlink (tmpc);
|
||||||
}
|
}
|
||||||
|
|
@ -1728,7 +1735,6 @@ SoundFileOmega::check_link_status (const Session* s, const vector<string>& paths
|
||||||
out:
|
out:
|
||||||
g_rmdir (tmpdir.c_str());
|
g_rmdir (tmpdir.c_str());
|
||||||
return ret;
|
return ret;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SoundFileChooser::SoundFileChooser (string title, ARDOUR::Session* s)
|
SoundFileChooser::SoundFileChooser (string title, ARDOUR::Session* s)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue