-
Notifications
You must be signed in to change notification settings - Fork 104
Store Paths In Dataset After Moving. #192
Hello,
I have been using datasets as a way to store data in my experiment (Each participant has their own dataset with each trial being its separate session). One of the issue I have ran into is that I cannot easily copy/move the dataset to another location of my drive.
Currently, all store paths are save with their static path and moving/copying it will break all the links. Is there a way around it besides creating a new dateset file at the new location?
All reactions
Hey Zhi,
The store paths are saved as relative paths to the location of the dataset file, so if you're moving the entire dataset together (including the file and all stores), it should just work. If you instead were hoping to move just the dataset file, then yes, you'll need to reconstruct a new dataset file since the relative paths will have changed (but hopefully that's not too hard to do).
Replies: 1 comment 6 replies
Hey Zhi,
The store paths are saved as relative paths to the location of the dataset file, so if you're moving the entire dataset together (including the file and all stores), it should just work. If you instead were hoping to move just the dataset file, then yes, you'll need to reconstruct a new dataset file since the relative paths will have changed (but hopefully that's not too hard to do).
All reactions
I think I found the culprit.
When I load an existing datasets with:
dataset = Dataset.Load(datasetPath, autoSave: true);
The dataset is loaded with useRelativePaths set to false. I'm not exactly sure why it is set to false. The dataset file does not have a value for useRelativePaths and the JSON constructor just passes false, ignoring the code's default. Subsequently, the dataset is saved with useRelativePaths set to false.
You should be able to reproduce this by adding the following line to the DatasetRelativePaths function in DatasetTests.cs:
// reload the saved dataset and verify that store paths are still valid
var newDataset = Dataset.Load(newDatasetFile);
Assert.IsTrue(newDataset.Sessions[0].Partitions[0].AvailableStreams.Count() > 0);
// Check if relative path is set to true for the new dataset.
Assert.IsTrue(newDataset.UseRelativePaths);
}
All reactions
Interesting, that might indeed be a bug. We'll take a look.
All reactions
-
👍 1
Awesome, thanks!
All reactions
Hi Xi
I've updated the Dataset code so that Stores within it are always specified with relative paths if they reside on the same drive as the Dataset.
All reactions
Yeah! Thanks for the fix!!