diff options
author | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2007-06-21 11:07:11 (GMT) |
---|---|---|
committer | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2007-06-21 11:07:11 (GMT) |
commit | 427e9a00d739452482f4e53bd0744702933c0d1a (patch) | |
tree | 6a56f2af11f1a1aed08f8e73a4935e8a9e788458 /shell | |
parent | 3ebb8f129193dfe1bd6e5fa7edd4d5a78d650423 (diff) |
Add extension to files that come into the clipboard without one.
Diffstat (limited to 'shell')
-rw-r--r-- | shell/view/frame/clipboardbox.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/shell/view/frame/clipboardbox.py b/shell/view/frame/clipboardbox.py index 1eb1684..3bef447 100644 --- a/shell/view/frame/clipboardbox.py +++ b/shell/view/frame/clipboardbox.py @@ -22,6 +22,7 @@ import hippo import gtk from sugar import util +from sugar.objects import mime from view.clipboardicon import ClipboardIcon from sugar.clipboard import clipboardservice @@ -104,6 +105,11 @@ class ClipboardBox(hippo.CanvasBox): uri = urlparse.urlparse(uris[0]) path, file_name = os.path.split(uri.path) + root, ext = os.path.splitext(file_name) + if not ext or ext == '.': + mime_type = mime.get_for_file(uri.path) + file_name = root + '.' + mime.get_primary_extension(mime_type) + # Copy the file, as it will be deleted when the dnd operation finishes. new_file_path = os.path.join(path, 'cb' + file_name) shutil.copyfile(uri.path, new_file_path) |