MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / get_dir_and_file_from_path

Function get_dir_and_file_from_path

libcppcryptfs/util/fileutil.cpp:896–928  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

894
895
896bool
897get_dir_and_file_from_path(LPCWSTR path, wstring *dir, wstring *file)
898{
899
900 if (!wcscmp(path, L"\\")) {
901 if (dir)
902 *dir = L"\\";
903 if (file)
904 *file = L"";
905 return true;
906 }
907
908 LPCWSTR pLastSlash = wcsrchr(path, '\\');
909
910 if (!pLastSlash) {
911 return false;
912 }
913
914 if (file) {
915 *file = pLastSlash + 1;
916 }
917
918 if (dir) {
919 if (pLastSlash != path) {
920 *dir = path;
921 dir->erase(pLastSlash - path);
922 } else {
923 *dir = L"\\";
924 }
925 }
926
927 return true;
928}
929
930
931bool

Callers 5

CryptMoveFileInternalFunction · 0.85
storeMethod · 0.85
lookupMethod · 0.85
removeMethod · 0.85
load_dirMethod · 0.85

Calls 1

eraseMethod · 0.80

Tested by

no test coverage detected