英文:
How could I change path of electron storages(cache, crashpad, etc)
问题
I have been developing an app using electron, and I am trying to make it as portable as possible (and easily accessible to app data).
So I'm wondering if it's possible to change the paths of where electron stores the data to something like documents or even inside the app's folder (instead of %appdata%)
Thanks in advance
英文:
I have been developing an app using electron, and I am trying to make it as portable as possible (and easily accessible to app data).
So I'm wondering if it's possible to change the paths of where electron stores the data to something like documents or even inside the app's folder (instead of %appdata%)
Thanks in advance
答案1
得分: 1
为了使您的Electron应用程序在不同操作系统之间更加便携,您应该使用Electron可以访问的操作系统默认路径,例如用户的home
目录、documents
目录,或更好地使用您的应用程序的appData
目录。
请查看Electron的app.getPath(name)
和app.setPath(name, path)
方法以获取更多信息。
注意:在应用程序文件夹内直接存储任何形式的数据都是一个不好的主意。虽然可以进行"相对"数据引用,但应用程序更新会覆盖(即删除)其中存储的任何数据。
英文:
To make your Electron application portable, especially between operating systems, you should use the operating system default paths accessible by Electron, such as the users home
directory, documents
directory or better still your applications appData
directory.
See Electrons app.getPath(name)
and app.setPath(name, path)
methods for more information.
> Note: It is a bad idea to store any form of data directly within the applications folder. Whilst "relative" referencing the data may be possible, an application update will overwrite (IE: delete) any data stored within.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论