Skip to content

Commit

Permalink
Create the root folder if it doesn't exist (#226)
Browse files Browse the repository at this point in the history
* Create the root folder if it doesn't exist

* changelog

* Add a message when the root folder is created

* Improved message
  • Loading branch information
TheoLaudatQM authored Aug 23, 2024
1 parent 3734765 commit ad82bed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [Unreleased]
### Added
- results - Allow the data saver to create the root folder if it doesn't exist.

## [0.17.7] - 2024-08-20
### Added
- VoltageGateSequence - The `VoltageGateSequence` class facilitates the creation and management of complex pulse sequences, allowing dynamic voltage control, ramping, and bias compensation across gate elements.
Expand Down
6 changes: 5 additions & 1 deletion qualang_tools/results/data_handler/data_folder_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ def get_latest_data_folder(
root_data_folder = Path(root_data_folder)

if not root_data_folder.exists():
raise NotADirectoryError(f"Root data folder {root_data_folder} does not exist.")
try:
root_data_folder.mkdir(parents=True)
print(f"The provided root folder didn't exist, so it was created at '{root_data_folder.absolute()}'.")
except (Exception,):
raise NotADirectoryError(f"Root data folder {root_data_folder} does not exist.")

if current_folder_pattern is None:
current_folder_pattern = folder_pattern
Expand Down

0 comments on commit ad82bed

Please sign in to comment.