*/
#include "coretools.h"
-#ifdef _WIN32
-# include <mbctype.h> // MBCS (multibyte codepage stuff)
-#else
-# define _tcsinc(x) ((x) + 1)
-#endif
size_t linelen(const char *string, size_t maxlen)
{
return stringlen;
}
-void replace_char(TCHAR *s, int target, int repl)
-{
- TCHAR *p;
- for (p=s; *p != _T('\0'); p = _tcsinc(p))
- if (*p == target)
- *p = (TCHAR)repl;
-}
-
#include "UnicodeString.h"
-void replace_char(TCHAR *s, int target, int repl);
-
size_t linelen(const char *string, size_t maxlen);
#ifdef __cplusplus
PathContext files = m_files;
int file;
for (file = 0; file < m_files.GetSize(); file++)
- replace_char(&*files[file].begin(), '/', '\\');
+ files[file] = paths_ToWindowsPath(files[file]);
bool bRet = true;
String strFileTemp[3];
path1 = m_files[0];
if (path2.empty())
path2 = m_files[1];
- replace_char(&*path1.begin(), '\\', '/');
- replace_char(&*path2.begin(), '\\', '/');
+ path1 = paths_ToUnixPath(path1);
+ path2 = paths_ToUnixPath(path2);
inf_patch[0].name = strdup(ucr::toSystemCP(path1).c_str());
inf_patch[1].name = strdup(ucr::toSystemCP(path2).c_str());
#include "FileActionScript.h"
#include "locality.h"
#include "FileFilterHelper.h"
-#include "coretools.h"
#include "OptionsMgr.h"
static void ThrowConfirmCopy(const CDiffContext& ctxt, int origin, int destination, int count,
// Path can contain (because of difftools?) '/' and '\'
// so for comparing purposes, convert whole path to use '\\'
- replace_char(&*path1.begin(), '/', '\\');
- replace_char(&*path2.begin(), '/', '\\');
+ path1 = paths_ToWindowsPath(path1);
+ path2 = paths_ToWindowsPath(path2);
String base1 = ctxt.GetLeftPath(); // include trailing backslash
if (path1.compare(0, base1.length(), base1.c_str()) != 0)
#include "DirView.h"
#include "DirFrame.h"
#include "MainFrm.h"
-#include "coretools.h"
#include "paths.h"
#include "7zCommon.h"
#include "OptionsDef.h"
#include "FileLocation.h"
#include "MainFrm.h"
#include "resource.h"
-#include "coretools.h"
#include "FileTransform.h"
#include "SelectUnpackerDlg.h"
#include "paths.h"
#include "PatchDlg.h"
#include "PatchTool.h"
#include "diff.h"
-#include "coretools.h"
#include "paths.h"
#include "CompareOptions.h"
#include "PatchHTML.h"
#include "stdafx.h"
#include "PropRegistry.h"
#include "RegKey.h"
-#include "coretools.h"
#include "FileOrFolderSelect.h"
#include "OptionsDef.h"
#include "OptionsMgr.h"
_tcslwr(buffer2);
//make sure they both have \\ instead of /
- replace_char(buffer1, '/', '\\');
+ _tcscpy_safe(buffer1, paths_ToWindowsPath(buffer1).c_str());
m_vssHelper.SetProjectBase(buffer2);
TCHAR * pbuf2 = &buffer2[2];//skip the $/
return path.length() > ancestor.length() &&
string_compare_nocase(String(path.c_str(), path.c_str() + ancestor.length()), ancestor) == 0;
}
+
+static void replace_char(TCHAR *s, int target, int repl)
+{
+ TCHAR *p;
+ for (p=s; *p != _T('\0'); p = _tcsinc(p))
+ if (*p == target)
+ *p = (TCHAR)repl;
+}
+
+String paths_ToWindowsPath(const String& path)
+{
+ String winpath = path;
+ replace_char(&*winpath.begin(), '/', '\\');
+ return winpath;
+}
+
+String paths_ToUnixPath(const String& path)
+{
+ String unixpath = path;
+ replace_char(&*unixpath.begin(), '\\', '/');
+ return unixpath;
+}
bool paths_IsURLorCLSID(const String& path);
bool paths_IsDecendant(const String& path, const String& ancestor);
inline String paths_AddTrailingSlash(const String& path) { return !paths_EndsWithSlash(path) ? path + _T("\\") : path; }
+String paths_ToWindowsPath(const String& path);
+String paths_ToUnixPath(const String& path);