3649: Relative media paths used when creating new media objetcs by drag-and-drop
svn: r17087
This commit is contained in:
parent
0380d94a46
commit
50486bb909
@ -472,6 +472,9 @@ class GalleryTab(ButtonTab, DbGUIElement):
|
|||||||
if not gen.mime.is_valid_type(mime):
|
if not gen.mime.is_valid_type(mime):
|
||||||
return
|
return
|
||||||
photo = gen.lib.MediaObject()
|
photo = gen.lib.MediaObject()
|
||||||
|
base_dir = unicode(Utils.media_path(self.dbstate.db))
|
||||||
|
if os.path.exists(base_dir):
|
||||||
|
name = Utils.relative_path(name, base_dir)
|
||||||
photo.set_path(name)
|
photo.set_path(name)
|
||||||
photo.set_mime_type(mime)
|
photo.set_mime_type(mime)
|
||||||
basename = os.path.basename(name)
|
basename = os.path.basename(name)
|
||||||
|
@ -188,6 +188,9 @@ class MediaView(ListView):
|
|||||||
if not gen.mime.is_valid_type(mime):
|
if not gen.mime.is_valid_type(mime):
|
||||||
return
|
return
|
||||||
photo = gen.lib.MediaObject()
|
photo = gen.lib.MediaObject()
|
||||||
|
base_dir = unicode(Utils.media_path(self.dbstate.db))
|
||||||
|
if os.path.exists(base_dir):
|
||||||
|
name = Utils.relative_path(name, base_dir)
|
||||||
photo.set_path(name)
|
photo.set_path(name)
|
||||||
photo.set_mime_type(mime)
|
photo.set_mime_type(mime)
|
||||||
basename = os.path.basename(name)
|
basename = os.path.basename(name)
|
||||||
|
Loading…
Reference in New Issue
Block a user