-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from rm-diego/file_arguments
- Loading branch information
Showing
4 changed files
with
47 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Python Debugger: main.py", | ||
"type": "debugpy", | ||
"request": "launch", | ||
"program": "${workspaceFolder}/src/main.py", | ||
"console": "integratedTerminal", | ||
"args": [ | ||
"main", | ||
"..\\data\\test_log.txt", | ||
"..\\data\\test.dbc", | ||
"SAF_SpeedTest" | ||
], | ||
"justMyCode": false | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import os | ||
import sys | ||
|
||
def validate_file(file_path, description): | ||
""" | ||
@brief Validate if the given file exists and is a valid file. | ||
@param file_path Path to file | ||
@param description Description of the file for error messages | ||
@return Absolute path of the file if valid, else exits the program | ||
""" | ||
if not os.path.isfile(file_path): | ||
print(f"Error: The {description} '{file_path}' does not exist or is not a file.") | ||
sys.exit(1) | ||
return os.path.abspath(file_path) |