7H3*_*D3R 2 python windows-installer shortcut
我正在研究一个处理SQLite3数据库的Python程序.我使用cx_Freeze将其设为MSI设置文件.
由cx_Freeze生成的.msi设置文件生成的Windows快捷方式不提供快捷方式的工作目录属性.因此,当我使用桌面上创建的快捷方式运行可执行文件时,它会在桌面上创建数据库文件.
这可以通过为快捷方式提供不同的工作目录来更改.我怎么做?
我能够通过对cx_Freeze/windist.py进行一些小改动来解决问题.在add_config(),第61行,我改变了:
msilib.add_data(self.db, "Shortcut",
[("S_APP_%s" % index, executable.shortcutDir,
executable.shortcutName, "TARGETDIR",
"[TARGETDIR]%s" % baseName, None, None, None,
None, None, None, None)])
Run Code Online (Sandbox Code Playgroud)
至
msilib.add_data(self.db, "Shortcut",
[("S_APP_%s" % index, executable.shortcutDir,
executable.shortcutName, "TARGETDIR",
"[TARGETDIR]%s" % baseName, None, None, None,
None, None, None, "TARGETDIR")]) # <--- Working directory.
Run Code Online (Sandbox Code Playgroud)
感谢大家.