【问题标题】:Inno setup - allowing database modificationInno setup - 允许修改数据库
【发布时间】:2018-10-09 03:24:00
【问题描述】:

我的应用程序包含db,用户将能够通过 GUI 向db 添加数据。所以我需要授权用户修改db。我尝试了post 中的所有选项,但仍然不允许授权。 在这里,这是我尝试实现的示例(在“允许”列中选中“修改权限”):

这是我当前的代码:

#define MyAppName "aaa"
#define MyAppVersion "1.0"
#define MyAppExeName "aaa.exe"

[Setup]
AppId={{...-...-...-...-...}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
DefaultDirName={pf}\{#MyAppName}
DisableProgramGroupPage=yes
OutputDir=C:\...\output
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Dirs]
Name: "{app}\Logs"; Permissions: everyone-modify

[Files]
Source: "C:\...\aaa.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\...\list_files\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Permissions: everyone-modify
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

如何通过设置的创建过程向用户授予数据库访问权限?谢谢

【问题讨论】:

  • 一开始就不应该将数据存储到安装文件夹中。
  • 我听从了你的建议,但仍然不允许。
  • 我在你的脚本中看到了{app}\Logs。
  • 我是inno setup 的新手,我应该从我的代码中删除[Dirs] 部分吗?
  • @Martin Prikryl,根据您上面的 cmets,我设法解决了我的问题。谢谢

标签: inno-setup


【解决方案1】:
[Files]
Source: "C:\...\aaa.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\...\folder_files\*"; DestDir: "{localappdata}\name_application\folder_files\"; Flags: ignoreversion recursesubdirs createallsubdirs

【讨论】:

  • 不要授予所有用户对 Program Files 文件夹的写入权限!这是一个hack,而不是解决方案。另请参阅Application does not work when installed with Inno Setup。
  • 感谢您的评论。正如我所说,我是一个新手,也许我的以下问题可能是基本的:我知道我必须将我的 db 放在 AppData\Local 文件夹中,但我的 exe 必须放在 Program Files 文件夹中或者它可以与db 一起位于AppData\Local 文件夹中?
  • 如果应用程序要被机器的所有用户使用,它应该在Program Files。如果仅供安装的用户使用,可以在AppData\Local。
  • 根据 Martin Prikryl 的评论,我将 DestDir 切换为 {localappdata} 而不是 {app}
猜你喜欢
  • 1970-01-01
  • 2021-09-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-08-01
  • 1970-01-01
  • 1970-01-01
  • 2011-05-01
相关资源
最近更新 更多