|
|
@@ -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());
|