fix: enhance save_path handling in JPMaQSDownload to ensure valid directory structure

This commit is contained in:
Palash Tyagi 2024-11-13 16:48:20 +00:00
parent 9e1197662e
commit 5bcc1da4f0

View File

@ -246,8 +246,12 @@ impl JPMaQSDownload {
folder_path: &str,
) -> Result<(), Box<dyn Error>> {
// if the folder path does not exist, create it
// let save_path = folder_path.to_string() + "/JPMaQSData/";
let save_path = format!("{}/JPMaQSData/", folder_path);
let save_path = std::path::Path::new(&save_path)
.components()
.collect::<std::path::PathBuf>()
.to_string_lossy()
.to_string();
std::fs::create_dir_all(save_path.clone())?;
// get ticker count, and split into chunks of batch_size