From 86e8851bf37227b9f70f88e1788c7355422ee3b0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 25 Mar 2014 14:15:47 +0000 Subject: PathIsAbsolute/PathIsAbsoluteW published from the core git-svn-id: http://svn.miranda-ng.org/main/trunk@8737 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- bin10/lib/mir_core.lib | Bin 58834 -> 59270 bytes bin10/lib/mir_core64.lib | Bin 53856 -> 54254 bytes bin12/lib/mir_core.lib | Bin 58834 -> 59270 bytes bin12/lib/mir_core64.lib | Bin 53856 -> 54254 bytes include/delphi/m_core.inc | 4 ++++ include/m_core.h | 3 +++ src/mir_core/mir_core.def | 2 ++ src/mir_core/path.cpp | 24 ++++++++++++------------ 8 files changed, 21 insertions(+), 12 deletions(-) diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib index a2b0ebd2c1..c045bff939 100644 Binary files a/bin10/lib/mir_core.lib and b/bin10/lib/mir_core.lib differ diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib index 9fbca171a3..9194957fa7 100644 Binary files a/bin10/lib/mir_core64.lib and b/bin10/lib/mir_core64.lib differ diff --git a/bin12/lib/mir_core.lib b/bin12/lib/mir_core.lib index fe725515a6..cd6a4cb0e3 100644 Binary files a/bin12/lib/mir_core.lib and b/bin12/lib/mir_core.lib differ diff --git a/bin12/lib/mir_core64.lib b/bin12/lib/mir_core64.lib index 7421886dd3..9194957fa7 100644 Binary files a/bin12/lib/mir_core64.lib and b/bin12/lib/mir_core64.lib differ diff --git a/include/delphi/m_core.inc b/include/delphi/m_core.inc index 5f7f54538d..71ca89150f 100644 --- a/include/delphi/m_core.inc +++ b/include/delphi/m_core.inc @@ -651,6 +651,8 @@ procedure CreatePathToFile(wszFilePath:PAnsiChar); stdcall; external CoreDLL name 'CreatePathToFile'; function CreateDirectoryTree(const szDir:PAnsiChar):int; stdcall; external CoreDLL name 'CreateDirectoryTree'; +function PathIsAbsolute(const pSrc:PAnsiChar):int; stdcall; + external CoreDLL name 'PathIsAbsolute'; function PathToAbsolute(const pSrc:PAnsiChar; pOut:PAnsiChar; base:PAnsiChar=nil):int; stdcall; external CoreDLL name 'PathToAbsolute'; function PathToRelative(const pSrc:PAnsiChar; pOut:PAnsiChar):int; stdcall; @@ -660,6 +662,8 @@ procedure CreatePathToFileW(wszFilePath:PWideChar); stdcall; external CoreDLL name 'CreatePathToFileW'; function CreateDirectoryTreeW(const szDir:PWideChar):int; stdcall; external CoreDLL name 'CreateDirectoryTreeW'; +function PathIsAbsoluteW(const pSrc:PWideChar):int; stdcall; + external CoreDLL name 'PathIsAbsoluteW'; function PathToAbsoluteW(const pSrc:PWideChar; pOut:PWideChar; base:PWideChar=nil):int; stdcall; external CoreDLL name 'PathToAbsoluteW'; function PathToRelativeW(const pSrc:PWideChar; pOut:PWideChar):int; stdcall; diff --git a/include/m_core.h b/include/m_core.h index 98231d041e..d30bed459e 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -582,10 +582,12 @@ MIR_CORE_DLL(HINSTANCE) GetInstByAddress(void* codePtr); MIR_CORE_DLL(void) CreatePathToFile(char* wszFilePath); MIR_CORE_DLL(int) CreateDirectoryTree(const char* szDir); MIR_CORE_DLL(int) PathToRelative(const char *pSrc, char *pOut); +MIR_CORE_DLL(int) PathIsAbsolute(const char *pSrc); MIR_CORE_DLL(void) CreatePathToFileW(WCHAR* wszFilePath); MIR_CORE_DLL(int) CreateDirectoryTreeW(const WCHAR* szDir); MIR_CORE_DLL(int) PathToRelativeW(const WCHAR *pSrc, WCHAR *pOut); +MIR_CORE_DLL(int) PathIsAbsoluteW(const WCHAR *pSrc); #if defined( __cplusplus ) MIR_CORE_DLL(int) PathToAbsolute(const char *pSrc, char *pOut, char* base=0); @@ -597,6 +599,7 @@ MIR_CORE_DLL(int) PathToRelativeW(const WCHAR *pSrc, WCHAR *pOut); #define CreatePathToFileT CreatePathToFileW #define CreateDirectoryTreeT CreateDirectoryTreeW +#define PathIsAbsoluteT PathIsAbsoluteW #define PathToAbsoluteT PathToAbsoluteW #define PathToRelativeT PathToRelativeW diff --git a/src/mir_core/mir_core.def b/src/mir_core/mir_core.def index 3a30eaea4a..4fd9df1b85 100644 --- a/src/mir_core/mir_core.def +++ b/src/mir_core/mir_core.def @@ -262,3 +262,5 @@ mir_closeLog @259 db_mc_enable @260 db_mc_isEnabled @261 LoadLangPackDescr @262 +PathIsAbsolute @263 +PathIsAbsoluteW @264 diff --git a/src/mir_core/path.cpp b/src/mir_core/path.cpp index 8e0575f861..fd57404195 100644 --- a/src/mir_core/path.cpp +++ b/src/mir_core/path.cpp @@ -28,7 +28,7 @@ static char szMirandaPathLower[MAX_PATH]; static TCHAR szMirandaPathW[MAX_PATH]; static TCHAR szMirandaPathWLower[MAX_PATH]; -static int pathIsAbsolute(const char *path) +MIR_CORE_DLL(int) PathIsAbsolute(const char *path) { if (strlen(path) <= 2) return 0; @@ -40,7 +40,7 @@ static int pathIsAbsolute(const char *path) MIR_CORE_DLL(int) PathToRelative(const char *pSrc, char *pOut) { if ( !pSrc || !strlen(pSrc) || strlen(pSrc)>MAX_PATH) return 0; - if ( !pathIsAbsolute(pSrc)) { + if ( !PathIsAbsolute(pSrc)) { mir_snprintf(pOut, MAX_PATH, "%s", pSrc); return (int)strlen(pOut); } @@ -69,7 +69,7 @@ MIR_CORE_DLL(int) PathToAbsolute(const char *pSrc, char *pOut, char* base) if (pSrc[0] < ' ') return mir_snprintf(pOut, MAX_PATH, "%s", pSrc); - if (pathIsAbsolute(pSrc)) + if (PathIsAbsolute(pSrc)) return GetFullPathNameA(pSrc, MAX_PATH, pOut, NULL); if (base == NULL) @@ -115,7 +115,7 @@ MIR_CORE_DLL(int) CreateDirectoryTree(const char *szDir) /////////////////////////////////////////////////////////////////////////////// -static int pathIsAbsoluteW(const TCHAR *path) +MIR_CORE_DLL(int) PathIsAbsoluteW(const TCHAR *path) { if (lstrlen(path) <= 2) return 0; @@ -126,10 +126,10 @@ static int pathIsAbsoluteW(const TCHAR *path) MIR_CORE_DLL(int) PathToRelativeW(const WCHAR *pSrc, WCHAR *pOut) { - if ( !pSrc || !lstrlen(pSrc) || lstrlen(pSrc) > MAX_PATH) + if (!pSrc || !lstrlen(pSrc) || lstrlen(pSrc) > MAX_PATH) return 0; - if ( !pathIsAbsoluteW(pSrc)) + if (!PathIsAbsoluteW(pSrc)) mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc); else { TCHAR szTmp[MAX_PATH]; @@ -137,7 +137,7 @@ MIR_CORE_DLL(int) PathToRelativeW(const WCHAR *pSrc, WCHAR *pOut) mir_sntprintf(szTmp, SIZEOF(szTmp), _T("%s"), pSrc); _tcslwr(szTmp); if (_tcsstr(szTmp, szMirandaPathWLower)) - mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc+lstrlen(szMirandaPathWLower)); + mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc + lstrlen(szMirandaPathWLower)); else mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc); } @@ -146,7 +146,7 @@ MIR_CORE_DLL(int) PathToRelativeW(const WCHAR *pSrc, WCHAR *pOut) MIR_CORE_DLL(int) PathToAbsoluteW(const TCHAR *pSrc, TCHAR *pOut, TCHAR* base) { - if ( !pSrc || !wcslen(pSrc) || wcslen(pSrc) > MAX_PATH) { + if (!pSrc || !wcslen(pSrc) || wcslen(pSrc) > MAX_PATH) { *pOut = 0; return 0; } @@ -155,7 +155,7 @@ MIR_CORE_DLL(int) PathToAbsoluteW(const TCHAR *pSrc, TCHAR *pOut, TCHAR* base) if (pSrc[0] < ' ') return mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc); - if (pathIsAbsoluteW(pSrc)) + if (PathIsAbsoluteW(pSrc)) return GetFullPathName(pSrc, MAX_PATH, pOut, NULL); if (base == NULL) @@ -164,13 +164,13 @@ MIR_CORE_DLL(int) PathToAbsoluteW(const TCHAR *pSrc, TCHAR *pOut, TCHAR* base) if (pSrc[0] != '\\') mir_sntprintf(buf, MAX_PATH, _T("%s%s"), base, pSrc); else - mir_sntprintf(buf, MAX_PATH, _T("%s%s"), base, pSrc+1); + mir_sntprintf(buf, MAX_PATH, _T("%s%s"), base, pSrc + 1); return GetFullPathName(buf, MAX_PATH, pOut, NULL); } MIR_CORE_DLL(void) CreatePathToFileW(WCHAR* wszFilePath) { - WCHAR* pszLastBackslash = wcsrchr(wszFilePath, '\\'); + WCHAR *pszLastBackslash = wcsrchr(wszFilePath, '\\'); if (pszLastBackslash == NULL) return; @@ -182,7 +182,7 @@ MIR_CORE_DLL(void) CreatePathToFileW(WCHAR* wszFilePath) MIR_CORE_DLL(int) CreateDirectoryTreeW(const WCHAR* szDir) { DWORD dwAttributes; - WCHAR* pszLastBackslash, szTestDir[ MAX_PATH ]; + WCHAR *pszLastBackslash, szTestDir[MAX_PATH]; lstrcpynW(szTestDir, szDir, SIZEOF(szTestDir)); if ((dwAttributes = GetFileAttributesW(szTestDir)) != INVALID_FILE_ATTRIBUTES && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY)) -- cgit v1.2.3