-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
configfile stores the path to ground-grid
- Loading branch information
Showing
3 changed files
with
30 additions
and
1 deletion.
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
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,28 @@ | ||
import os | ||
import json_utils | ||
|
||
|
||
def get_configfile_path(programname="plenoirf.json"): | ||
return os.path.join(os.path.expanduser("~"), "." + programname) | ||
|
||
|
||
def read(): | ||
configfile_path = get_configfile_path() | ||
if not os.path.exists(configfile_path): | ||
write(config=default(build_dir="build")) | ||
|
||
with open(configfile_path, "rt") as f: | ||
config = json_utils.loads(f.read()) | ||
return config | ||
|
||
|
||
def write(config): | ||
with open(get_configfile_path(), "wt") as f: | ||
f.write(json_utils.dumps(config, indent=4)) | ||
|
||
|
||
def default(merlict_c89_ground_grid_path): | ||
out = { | ||
"ground-grid": os.path.abspath(merlict_c89_ground_grid_path), | ||
} | ||
return out |
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 |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "1.0.2" | ||
__version__ = "1.0.4" |