Skip to content

Commit 0a0f246

Browse files
Added linking to local files when the local file name doesn't match expected file name
1 parent 1d5a551 commit 0a0f246

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pyclowder/connectors.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,13 @@ def _prepare_dataset(self, host, secret_key, resource):
254254
if not file_path:
255255
missing_files.append(ds_file)
256256
else:
257+
# Create a link to the original file if the "true" name of the file doesn't match what's on disk
258+
if not file_path.lower().endswith(ds_file['filename'].lower()):
259+
ln_name = io.join_paths(tempfile.gettempdir(), ds_file['filename'])
260+
os.symlink(file_path, ln_name)
261+
tmp_files_created.append(ln_name)
262+
file_path = ln_name
263+
257264
# Also get file metadata in format expected by extrator
258265
(file_md_dir, file_md_tmp) = self._download_file_metadata(host, secret_key, ds_file['id'],
259266
ds_file['filepath'])

0 commit comments

Comments
 (0)