MCPcopy Create free account
hub / github.com/WinDurango/WinDurango / FixRelativePath

Function FixRelativePath

projects/WinDurango.KernelX/src/kernelx.cpp:702–758  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

700EXTERN_C BOOL __stdcall XMemPreallocateFreeSpace()
701{
702 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
703 return FALSE;
704}
705
706EXTERN_C BOOL __stdcall XMemGetAllocationStatistics()
707{
708 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
709 return FALSE;
710}
711
712EXTERN_C HANDLE __stdcall XMemGetAuxiliaryTitleMemory()
713{
714 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
715 return nullptr;
716}
717
718EXTERN_C void __stdcall XMemReleaseAuxiliaryTitleMemory(_In_opt_ HANDLE hHandle)
719{
720 UNREFERENCED_PARAMETER(hHandle);
721 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
722}
723
724
725void FixRelativePath(LPCWSTR &lpFileName)
726{
727 static std::wstring convert{};
728 std::wstring_view fileName(lpFileName);
729
730 if (fileName.size() == 0)
731 return;
732
733 int length = fileName.length();
734
735 if (fileName[0] == '.' && fileName[1] == '\\')
736 {
737 static std::wstring trimPath{};
738 trimPath = fileName.substr(2);
739 fileName = trimPath.data();
740 convert = std::filesystem::current_path().c_str();
741 if (convert.back() != '\\')
742 {
743 convert.append(L"\\");
744 }
745 convert.append(fileName);
746 std::replace(convert.begin(), convert.end(), L'\\', L'/');
747 std::replace(convert.begin(), convert.end(), L'//', L'/');
748
749 lpFileName = convert.data();
750 return;
751 }
752 if (fileName[1] != ':')
753 {
754 convert = std::filesystem::current_path().c_str();
755 convert.append(L"\\");
756 convert.append(fileName);
757 std::replace(convert.begin(), convert.end(), L'\\', L'/');
758 std::replace(convert.begin(), convert.end(), L'//', L'/');
759

Callers 9

EraCreateFileWFunction · 0.85
EraCreateFileAFunction · 0.85
EraCreateFile2Function · 0.85
EraCreateDirectoryAFunction · 0.85
EraGetFileAttributesWFunction · 0.85
EraGetFileAttributesExWFunction · 0.85
EraFindFirstFileWFunction · 0.85
EraDeleteFileWFunction · 0.85
EraLoadLibraryExWFunction · 0.85

Calls 2

dataMethod · 0.80
c_strMethod · 0.80

Tested by

no test coverage detected