details: http://www.bx.psu.edu/hg/galaxy/rev/6b93e705c8a4 changeset: 3629:6b93e705c8a4 user: Nate Coraor <nate@bx.psu.edu> date: Mon Apr 12 17:24:17 2010 -0400 description: If a subdir of the library import dir is a symlink and we are linking instead of copying data on import, dereference that symlink diffstat: lib/galaxy/web/controllers/library_common.py | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diffs (25 lines): diff -r c19605dca27d -r 6b93e705c8a4 lib/galaxy/web/controllers/library_common.py --- a/lib/galaxy/web/controllers/library_common.py Mon Apr 12 15:56:13 2010 -0400 +++ b/lib/galaxy/web/controllers/library_common.py Mon Apr 12 17:24:17 2010 -0400 @@ -915,8 +915,19 @@ for entry in os.listdir( full_dir ): # Only import regular files path = os.path.join( full_dir, entry ) - if os.path.islink( path ) and os.path.isfile( path ) and params.get( 'link_data_only', False ): - # If we're linking instead of copying, link the file the link points to, not the link itself. + if os.path.islink( full_dir ) and params.get( 'link_data_only', False ): + # If we're linking instead of copying and the + # sub-"directory" in the import dir is actually a symlink, + # dereference the symlink, but not any of its contents. + link_path = os.readlink( full_dir ) + if os.path.isabs( link_path ): + path = os.path.join( link_path, entry ) + else: + path = os.path.abspath( os.path.join( link_path, entry ) ) + elif os.path.islink( path ) and os.path.isfile( path ) and params.get( 'link_data_only', False ): + # If we're linking instead of copying and the "file" in the + # sub-directory of the import dir is actually a symlink, + # dereference the symlink (one dereference only, Vasili). link_path = os.readlink( path ) if os.path.isabs( link_path ): path = link_path