diff options
author | David Robillard <d@drobilla.net> | 2014-11-22 01:32:31 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2014-11-22 01:32:31 +0000 |
commit | ee7ad94720483fc24deb108441b65acf8e03f66d (patch) | |
tree | 425aa5cd6d007d61b321d1573106fb4f7b175159 /src/util.c | |
parent | 48e05557b8afac26bcdd0416ef0ab9a18037e529 (diff) | |
download | lilv-ee7ad94720483fc24deb108441b65acf8e03f66d.tar.gz lilv-ee7ad94720483fc24deb108441b65acf8e03f66d.tar.bz2 lilv-ee7ad94720483fc24deb108441b65acf8e03f66d.zip |
Windows fixes (thanks John Emmas).
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@5491 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -35,6 +35,17 @@ # include <io.h> # define F_OK 0 # define mkdir(path, flags) _mkdir(path) +# if (defined(_MSC_VER) && (_MSC_VER < 1500)) +/** Implement 'CreateSymbolicLink()' for MSVC 8 or earlier */ +BOOLEAN WINAPI +CreateSymbolicLink(LPCTSTR linkpath, LPCTSTR targetpath, DWORD flags) +{ + typedef BOOLEAN (WINAPI* PFUNC)(LPCTSTR, LPCTSTR, DWORD); + + PFUNC pfn = (PFUNC)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "CreateSymbolicLinkA"); + return pfn ? pfn(linkpath, targetpath, flags) : 0; +} +# endif /* _MSC_VER < 1500 */ #else # include <dirent.h> # include <unistd.h> @@ -429,6 +440,9 @@ lilv_symlink(const char* oldpath, const char* newpath) if (strcmp(oldpath, newpath)) { #ifdef _WIN32 ret = !CreateSymbolicLink(newpath, oldpath, 0); + if (ret) { + ret = !CreateHardLink(newpath, oldpath, 0); + } #else ret = symlink(oldpath, newpath); #endif |