Skip to content

Navigation Menu

Sign in
Sign up

Store Paths In Dataset After Moving. #192

Answered by sandrist
Zhi (xiangzhi) asked this question in Q&A
Discussion options

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?

You must be logged in to vote

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

Comment options

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).

You must be logged in to vote
6 replies
Comment options

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);
 }
Comment options

Interesting, that might indeed be a bug. We'll take a look.

Comment options

Awesome, thanks!

Comment options

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.

#201

Comment options

Yeah! Thanks for the fix!!

Answer selected by xiangzhi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /