Pergunta

I have a small software for MacOS with a simple dmg installer (Open, drag and drop to Application folder, you know). My problem is, that the software writes a small ini file inside the .app package and if I update the software, this file is lost, because the old package is removed before writing the new one.

My question is, if any of you know an elegant solution for this. The user should be able to save the file in any place e. g. desktop and the ini file should be moved into the new package. I don't want to save this file outside the .app package, because this would leave private data on the computer if the user just removes the package.

Thanks in advance!

Foi útil?

Solução

Saving data into the aplication bundle is no good practice,
for future release, please implement another solution.

To solve the current problem, I can think of two solutions:

Add two files to the .dmg file

  • The new application.
  • Backuptool: An simple AppleScript to backup the file would do the job.

Make sure to notify the user to run the backup before replacing the application.
The user might however forget to run the backup, and loose data.

Create an installer

Another option would be to write an installer using PackageMaker.
PackageMaker provides options to run scripts before updating the Application.
Add an pre-installation script that backups the data.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top