mirror of
https://github.com/pocketpy/pocketpy
synced 2025-12-07 18:50:19 +00:00
Update main.cpp
This commit is contained in:
parent
86a290e6c4
commit
0b2d54f88d
@ -66,14 +66,15 @@ int main(int argc, char** argv){
|
|||||||
filepath = std::filesystem::absolute(filepath);
|
filepath = std::filesystem::absolute(filepath);
|
||||||
if(!std::filesystem::exists(filepath)){
|
if(!std::filesystem::exists(filepath)){
|
||||||
std::cerr << "File not found: " << argv_1 << std::endl;
|
std::cerr << "File not found: " << argv_1 << std::endl;
|
||||||
return 1;
|
return 2;
|
||||||
}
|
}
|
||||||
std::ifstream file(filepath);
|
std::ifstream file(filepath);
|
||||||
if(!file.is_open()){
|
if(!file.is_open()){
|
||||||
std::cerr << "Failed to open file: " << argv_1 << std::endl;
|
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>());
|
std::string src((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
|
||||||
|
file.close();
|
||||||
|
|
||||||
// set parent path as cwd
|
// set parent path as cwd
|
||||||
std::filesystem::current_path(filepath.parent_path());
|
std::filesystem::current_path(filepath.parent_path());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user