Update main.cpp

This commit is contained in:
blueloveTH 2023-03-29 11:03:58 +08:00
parent 86a290e6c4
commit 0b2d54f88d

View File

@ -66,14 +66,15 @@ int main(int argc, char** argv){
filepath = std::filesystem::absolute(filepath);
if(!std::filesystem::exists(filepath)){
std::cerr << "File not found: " << argv_1 << std::endl;
return 1;
return 2;
}
std::ifstream file(filepath);
if(!file.is_open()){
std::cerr << "Failed to open file: " << argv_1 << std::endl;
return 1;
return 3;
}
std::string src((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
file.close();
// set parent path as cwd
std::filesystem::current_path(filepath.parent_path());