Skip to content

Commit f8b09b1

Browse files
committed
Updated logic for creating destination file path names for CLEM context
1 parent 7b7e12b commit f8b09b1

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/murfey/client/contexts/clem.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"""
55

66
import logging
7-
from datetime import datetime
87
from pathlib import Path
98
from typing import Dict, Generator, List, Optional
109
from urllib.parse import quote
@@ -31,13 +30,16 @@ def _file_transferred_to(
3130
instrument_name=environment.instrument_name,
3231
demo=environment.demo,
3332
)
34-
# rsync basepath and modules are set in the microscope's configuration YAML file
35-
return (
36-
Path(machine_config.get("rsync_basepath", ""))
37-
/ str(datetime.now().year)
38-
/ source.name
39-
/ file_path.relative_to(source)
33+
34+
# Construct destination path
35+
base_destination = Path(machine_config.get("rsync_basepath", "")) / Path(
36+
environment.default_destinations[source]
4037
)
38+
# Add the visit number to the path if it's not present in 'source'
39+
if environment.visit not in environment.default_destinations[source]:
40+
base_destination = base_destination / environment.visit
41+
destination = base_destination / file_path.relative_to(source)
42+
return destination
4143

4244

4345
def _get_source(

0 commit comments

Comments
 (0)