From cbe0ea84c184bcf3e8b25828e946e115ad78bea8 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 13 Oct 2018 13:18:17 -0400 Subject: [PATCH] Define FileNames::HardLinkeFile, but nonfunctional on Windows --- src/FileNames.cpp | 14 ++++++++++++++ src/FileNames.h | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/src/FileNames.cpp b/src/FileNames.cpp index 866241ed3..76c513f04 100644 --- a/src/FileNames.cpp +++ b/src/FileNames.cpp @@ -69,6 +69,20 @@ bool FileNames::CopyFile( #endif } +bool FileNames::HardLinkFile( const wxString& file1, const wxString& file2 ) +{ +#ifdef __WXMSW__ + + // return ::CreateHardLinkA( file1.c_str(), file2.c_str(), NULL ); + return false; + +#else + + return 0 == ::link( file1.c_str(), file2.c_str() ); + +#endif +} + wxString FileNames::MkDir(const wxString &Str) { // Behaviour of wxFileName::DirExists() and wxFileName::MkDir() has diff --git a/src/FileNames.h b/src/FileNames.h index 79cba8340..354c48fdb 100644 --- a/src/FileNames.h +++ b/src/FileNames.h @@ -27,6 +27,11 @@ public: static bool CopyFile( const wxString& file1, const wxString& file2, bool overwrite = true); + // wxWidgets doesn't have a function to do this: make a hard file-system + // link if possible. It might not be, as when the paths are on different + // storage devices. + static bool HardLinkFile( const wxString& file1, const wxString& file2); + static wxString MkDir(const wxString &Str); static wxString TempDir();