summaryrefslogtreecommitdiff
path: root/shared/longPathPrefix.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:08:06 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:08:06 +0200
commitfbe76102e941b9f1edaf236788e42678f05fdf9a (patch)
treef5f538316019fa89be8dc478103490c3a826f3ac /shared/longPathPrefix.cpp
parent3.8 (diff)
downloadFreeFileSync-fbe76102e941b9f1edaf236788e42678f05fdf9a.tar.gz
FreeFileSync-fbe76102e941b9f1edaf236788e42678f05fdf9a.tar.bz2
FreeFileSync-fbe76102e941b9f1edaf236788e42678f05fdf9a.zip
3.9
Diffstat (limited to 'shared/longPathPrefix.cpp')
-rw-r--r--shared/longPathPrefix.cpp61
1 files changed, 0 insertions, 61 deletions
diff --git a/shared/longPathPrefix.cpp b/shared/longPathPrefix.cpp
deleted file mode 100644
index e8b14b90..00000000
--- a/shared/longPathPrefix.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-// **************************************************************************
-// * This file is part of the FreeFileSync project. It is distributed under *
-// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
-// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) *
-// **************************************************************************
-//
-#include "longPathPrefix.h"
-#include <wx/msw/wrapwin.h> //includes "windows.h"
-
-
-//there are two flavors of long path prefix: one for UNC paths, one for regular paths
-const Zstring LONG_PATH_PREFIX = DefaultStr("\\\\?\\");
-const Zstring LONG_PATH_PREFIX_UNC = DefaultStr("\\\\?\\UNC");
-
-template <size_t max_path>
-inline
-Zstring applyLongPathPrefixImpl(const Zstring& path)
-{
- if ( path.length() >= max_path && //maximum allowed path length without prefix is (MAX_PATH - 1)
- !path.StartsWith(LONG_PATH_PREFIX))
- {
- if (path.StartsWith(DefaultStr("\\\\"))) //UNC-name, e.g. \\zenju-pc\Users
- return LONG_PATH_PREFIX_UNC + path.AfterFirst(DefaultChar('\\')); //convert to \\?\UNC\zenju-pc\Users
- else
- return LONG_PATH_PREFIX + path; //prepend \\?\ prefix
- }
-
- //fallback
- return path;
-}
-
-
-Zstring FreeFileSync::applyLongPathPrefix(const Zstring& path)
-{
- return applyLongPathPrefixImpl<MAX_PATH>(path);
-}
-
-
-Zstring FreeFileSync::applyLongPathPrefixCreateDir(const Zstring& path) //throw()
-{
- //special rule for ::CreateDirectoryEx(): MAX_PATH - 12(=^ 8.3 filename) is threshold
- return applyLongPathPrefixImpl<MAX_PATH - 12>(path);
-}
-
-
-Zstring FreeFileSync::removeLongPathPrefix(const Zstring& path) //throw()
-{
- if (path.StartsWith(LONG_PATH_PREFIX))
- {
- Zstring finalPath = path;
- if (path.StartsWith(LONG_PATH_PREFIX_UNC)) //UNC-name
- finalPath.Replace(LONG_PATH_PREFIX_UNC, DefaultStr("\\"), false);
- else
- finalPath.Replace(LONG_PATH_PREFIX, DefaultStr(""), false);
- return finalPath;
- }
-
- //fallback
- return path;
-}
-
bgstack15