edit CWD problem

This commit is contained in:
2026-08-31 16:51:47 +09:00
parent 0b90e87f21
commit 0339ddcd91
3 changed files with 31 additions and 34 deletions
+14 -10
View File
@@ -20,9 +20,8 @@ bool FileReader(MyZip &zip, std::string strInputPath, const std::filesystem::pat
// file valid check
if (!filesystem::exists(pathObj))
{
string strDbg = "[ERROR] File not found : " + pathObj.string();
strDbg += "\r\n";
OutputDebugStringA(strDbg.c_str());
printf("[ERROR](FileReader) Something went Wrong..!! \r\n");
printf("[ERROR] File not found : %s ", pathObj.string().c_str());
bRet = false;
}
@@ -48,7 +47,8 @@ bool FileReader(MyZip &zip, std::string strInputPath, const std::filesystem::pat
strDbg += "\r\n";
OutputDebugStringA(strDbg.c_str());
bRet = zip.AddFileToZip(pathObj.string());
auto absPathOjb = filesystem::absolute(pathObj);
bRet = zip.AddFileToZip(absPathOjb.generic_string(), pathObj.generic_string());
break;
}
@@ -73,6 +73,7 @@ bool FileReader(MyZip &zip, std::string strInputPath, const std::filesystem::pat
OutputDebugStringA(strDbg.c_str());
// recursive traversal
// TODO : bRet 쓰는 곳이 없음. 파일 처리 실패 시 어떻게 할 건지 정해야 함.
bRet = FileReader(zip, currentAbsPath.string(), rootPath);
}
else if (filesystem::is_regular_file(currentEntry))
@@ -85,11 +86,15 @@ bool FileReader(MyZip &zip, std::string strInputPath, const std::filesystem::pat
// archiving file
auto relativePath = filesystem::relative(currentAbsPath, rootPath);
bRet = zip.AddFileToZip(relativePath.string());
// generic_string : make back-slash to OS independant delimeter ("\\" -> "/")
// TODO : bRet 쓰는 곳이 없음. 파일 처리 실패 시 어떻게 할 건지 정해야 함.
bRet = zip.AddFileToZip(currentAbsPath.generic_string(), relativePath.generic_string());
}
else
{
OutputDebugStringA("[ERROR] Wrong Type of File");
printf("[ERROR](FileReader) Something went Wrong..!! \r\n");
printf("[ERROR](FileReader) Maybe its corrupted file. \r\n");
bRet = false;
}
@@ -103,9 +108,8 @@ bool FileReader(MyZip &zip, std::string strInputPath, const std::filesystem::pat
// case 3 : ERROR
case eFILETYPE::ETC:
{
// 이런 경우가 있으려나? 일단 혹시 모르니까
string strErr = "[ERROR] Something went Wrong..!!";
OutputDebugStringA(strErr.c_str());
printf("[ERROR](FileReader) Something went Wrong..!! \r\n");
printf("[ERROR](FileReader) Maybe its corrupted file. \r\n");
bRet = false;
break;
@@ -114,7 +118,7 @@ bool FileReader(MyZip &zip, std::string strInputPath, const std::filesystem::pat
break;
};
// TODO : 실패 상황 별 다른 코드 부여 + 코드 별 처리 어떻게 할 건지?
// TODO : 실패 상황 별 다른 코드 부여? + 코드 별 처리 어떻게 할 건지?
return bRet;
}