src/eric7/eric7_post_install.py

branch
eric7
changeset 9346
eda0bdb22e67
parent 9221
bf71ee032bb4
child 9377
b9c8dc3b7da1
diff -r 58a1e7c960b8 -r eda0bdb22e67 src/eric7/eric7_post_install.py
--- a/src/eric7/eric7_post_install.py	Thu Sep 22 19:45:29 2022 +0200
+++ b/src/eric7/eric7_post_install.py	Fri Sep 23 10:58:55 2022 +0200
@@ -189,7 +189,8 @@
     for desktop in ["eric7.desktop", "eric7_browser.desktop"]:
         copyDesktopFile(
             os.path.join(linuxDir, desktop),
-            os.path.join(dstDir, "applications", desktop),
+            os.path.join(dstDir, "applications"),
+            desktop,
             scriptsDir,
         )
 
@@ -212,19 +213,27 @@
     os.chmod(dstname, 0o644)
 
 
-def copyDesktopFile(src, dst, scriptsdir):
+def copyDesktopFile(src, dstPath, dstFile, scriptsdir):
     """
     Modify a desktop file and write it to its destination.
 
-    @param src source file name (string)
-    @param dst destination file name (string)
-    @param scriptsdir directory containing the scripts (string)
+    @param src source file name
+    @type str
+    @param dstPath path name of the directory for the file to be written
+    @type str
+    @param dstFile name of the file to be written
+    @type str
+    @param scriptsdir directory containing the scripts
+    @type str
     """
     with open(src, "r", encoding="utf-8") as f:
         text = f.read()
 
     text = text.replace("@BINDIR@", scriptsdir)
 
+    if not os.path.isdir(dstPath):
+        os.makedirs(dstPath)
+    dst = os.path.join(dstPath, dstFile)
     with open(dst, "w", encoding="utf-8") as f:
         f.write(text)
     os.chmod(dst, 0o644)

eric ide

mercurial