Compare commits

...

3 Commits

Author SHA1 Message Date
Borja Garcia af79a7dc6c
Merge b6df4b8699 into 28efd18798 2026-03-15 22:55:20 -04:00
Borja Garcia b6df4b8699
Merge pull request #1 from debuti/Bit-file-validation
Add file existence check before processing
2025-11-08 00:26:22 +01:00
Borja Garcia 4d23e09fb2
Add file existence check before processing
Added a check to verify if the specified file exists and is readable before proceeding.
2025-11-08 00:25:33 +01:00
1 changed files with 10 additions and 0 deletions

View File

@ -184,6 +184,16 @@ int main(int argc, char **argv)
return EXIT_SUCCESS;
}
// Check if file exists and is readable
{
std::ifstream file(args.bit_file);
if (!args.bit_file.empty() && !file.good()) {
printError("Error: cannot open file '" + args.bit_file + "'");
return EXIT_FAILURE;
}
file.close();
}
if (args.prg_type == Device::WR_SRAM)
cout << "write to ram" << endl;
if (args.prg_type == Device::WR_FLASH)