summaryrefslogtreecommitdiff
path: root/Mozo
diff options
context:
space:
mode:
authorinfirit <[email protected]>2015-07-23 15:29:06 +0200
committerinfirit <[email protected]>2015-07-23 15:29:06 +0200
commitfda48486887af5cf04f58cb977c0143f94d2448b (patch)
tree18f538b2c5857bf7f796312aa3560f85a59ea71a /Mozo
parent614652102ebe2a631d51dd4356106c9921c5a142 (diff)
downloadmozo-fda48486887af5cf04f58cb977c0143f94d2448b.tar.bz2
mozo-fda48486887af5cf04f58cb977c0143f94d2448b.tar.xz
Don't use a hardcoded path in /tmp
Diffstat (limited to 'Mozo')
-rw-r--r--Mozo/MainWindow.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Mozo/MainWindow.py b/Mozo/MainWindow.py
index 41fa9a5..0239044 100644
--- a/Mozo/MainWindow.py
+++ b/Mozo/MainWindow.py
@@ -547,8 +547,10 @@ class MainWindow:
content_type = file_info.get_content_type()
if content_type == 'application/x-desktop':
input_stream = myfile.read()
- open('/tmp/mozo-dnd.desktop', 'w').write(input_stream.read())
- parser = util.DesktopParser('/tmp/mozo-dnd.desktop')
+ (fd, tmppath) = tempfile.mkstemp(prefix='mozo-dnd', suffix='.desktop')
+ with open(fd, "w") as f:
+ f.write(input_stream.read())
+ parser = util.DesktopParser(tmppath)
self.editor.createItem(parent, parser.get('Icon'), parser.get('Name', self.editor.locale), parser.get('Comment', self.editor.locale), parser.get('Exec'), parser.get('Terminal'), before, after)
elif content_type in ('application/x-shellscript', 'application/x-executable'):
self.editor.createItem(parent, None, os.path.split(file_path)[1].strip(), None, file_path.replace('file://', '').strip(), False, before, after)