From 0d6512c8427bcf129ce76cbacff8c104afbde920 Mon Sep 17 00:00:00 2001 From: Juno Kim Date: Tue, 1 Sep 2026 11:20:35 +0900 Subject: [PATCH] update known issue --- src/MyZip.cpp | 9 +++++---- src/main.cpp | 17 ++++++----------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/MyZip.cpp b/src/MyZip.cpp index bc19bea..3f505e3 100644 --- a/src/MyZip.cpp +++ b/src/MyZip.cpp @@ -98,11 +98,12 @@ bool MyZip::FinalizeZip() this->EOCDR.sizeOfCentralDir += (sizeof(p.header) + p.header.lengthOfFileName); } - auto offset = static_cast(fileOut.tellp()); + auto offset = fileOut.tellp(); if (offset == static_cast(-1)) { printf("[ ERROR ](FinalizeZip) Failed to get offset"); fileOut.close(); + return false; } this->EOCDR.offsetCentralDir = static_cast(offset); @@ -115,7 +116,7 @@ bool MyZip::FinalizeZip() if (fileOut.fail()) { - printf("[ ERROR ](FinalizeZip) Disk write failed while writing central directory entries (Disk full?)\n"); + printf("[ ERROR ](FinalizeZip) Disk write failed \n"); fileOut.close(); return false; } @@ -125,7 +126,7 @@ bool MyZip::FinalizeZip() fileOut.write(reinterpret_cast(&this->EOCDR), sizeof(this->EOCDR)); if (fileOut.fail()) { - printf("[ ERROR ](FinalizeZip) Disk write failed while writing EOCDR\n"); + printf("[ ERROR ](FinalizeZip) Disk write failed \n"); fileOut.close(); return false; } @@ -134,7 +135,7 @@ bool MyZip::FinalizeZip() fileOut.close(); if (fileOut.fail()) { - printf("[ ERROR ](FinalizeZip) Failed to close/flush file (Disk full?)\n"); + printf("[ ERROR ](FinalizeZip) Failed to close/flush file (Maybe Disk full?)\n"); return false; } } diff --git a/src/main.cpp b/src/main.cpp index 8afdd48..2e4b74d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -48,7 +48,8 @@ bool FileReader(MyZip &zip, std::string strInputPath, const std::filesystem::pat OutputDebugStringA(strDbg.c_str()); auto absPathOjb = filesystem::absolute(pathObj); - bRet = zip.AddFileToZip(absPathOjb.generic_string(), rootPath.generic_string()); + auto relativePath = filesystem::relative(pathObj, rootPath); + bRet = zip.AddFileToZip(absPathOjb.generic_string(), relativePath.generic_string()); break; } @@ -127,25 +128,19 @@ int main(int argc, char* argv[]) /** [-Known Issue-] - 1. 입력 경로의 상위 디렉터리 전체가 불필요하게 중첩 폴더로 생성되는 현상 - - 현상 : 단일 파일 경로 지정 시, 드라이브 및 상위 디렉터리 계층(d:\MyCode\4_Doc\...)이 - 압축 파일 내부에 그대로 중첩 생성됨 - - 원인 : 입력 경로를 상대 경로로 정규화하지 않고 절대 경로 전체를 압축 내부 엔트리 경로로 사용 - - 기대값 : 입력 파일 (혹은 디렉토리) 만 압축되어 저장. - - 2. 폴더 순회구조의 문제 + 1. 폴더 순회구조의 문제 - 문제 : 전역변수(g_recursive_counter)및 함수(FileReader) 의 전역사용 - 기대값 : 폴더 순회구조 또한 클래스화 - 3. CentralDirectory 설계문제 + 2. CentralDirectory 설계문제 - 문제 : CentralDirectory 를 채우는 코드가 분산됨. - 기대값 : 한 곳으로 집중. - 4. 내부 상태 플래그 (bRet) 의 미구현 + 3. 내부 상태 플래그 (bRet) 의 미구현 - 현상 : 프로그램의 실패 상황 별 플래그값인 "bool bRet" 의 미구현 - 기대값 : 일반적인 error code 로써 동작하는 리턴 값으로 사용. - 5. 예외처리 설계 및 구현의 부재 + 4. 예외처리 설계 및 구현의 부재 - 현상 : File I/O, 경로검사 등 일관된 형식의 예외처리와 Message 처리가 없음. - 기대값 : 에러 조기발견