问题
I have a C++ program which connects to an Access database via OBDC System DSN connection. That DSN is a path to the MDB in the ProgramData folder. When User A runs the app, it copies that MDB file to their AppData\Local folder and any updates to the MDB the app makes, it does to the one in their AppData folder. This is no good because if User B runs the app I want them to see the changes that User A made to the MDB.
1) Is there a way to force it to NOT copy the MDB to their AppData folder and instead just use the one in ProgramData?
2) Am I doing this correctly? Should I be putting the MDB in a different location other than ProgramData where it will be properly shared?
3) Do I need to have my app on start up compare timestamps for the MDB? On start up I could have it pull from ProgramData and when it closes I could have it write back to ProgramData? This seems like a hack and I dont even know if permissions would be an issue
回答1:
Use (a subfolder of) the shared folder, %Public%
which directs to C:\Users\Public.
回答2:
This post is relevant to OP's comment and previous answer by Gustav:
Use (a subfolder of) the shared folder, %Public% which directs to C:\Users\Public.
I am not an Inno setup expert either but I don't think a predefined constant for "C:\Users\Public" exists. But if its only a constant you want you can always do this.
Create a constant using #define macro at the very top of your script such as this.
#define sf "C:\Users\Public"
And you can use it in your script wherever you want. Ex:
[Files]
Source: "app.exe"; DestDir: "{#sf}\MyApp\";
来源:https://stackoverflow.com/questions/43307877/c-app-mdb-in-programdata-copies-to-users-appdata-folder-when-i-dont-want-it-t