I recently developed a vscode plugin, since in the code I would cache some data to local disk, when the plugin was updated, I found that the previously cached data were gone.
我最近开发了一个vscode插件,因为在代码中我会将一些数据缓存到本地磁盘,当插件更新时,我发现以前缓存的数据不见了。
After checking, since the data cached by the plugin is stored in the plugin's installation directory, when the plugin is updated, the old plugin will be deleted, so its corresponding data will also be deleted.
经过检查,由于插件缓存的数据存储在插件的安装目录中,当插件更新时,旧插件会被删除,因此其相应的数据也会被删除。
Is there any way to realize that the cached data will not be deleted when the plugin is updated?
有没有什么方法可以实现插件更新时缓存的数据不会被删除?
My current solution, when the vscode plugin is launched, is to find the previous version of the plugin directory by getting the installation directory of the plugin (I've found that when the plugin is updated, the old plugin isn't deleted right away, but rather the next time vscode is launched), and to copy the cached data files from within the previous version of the plugin
我目前的解决方案是,当vscode插件启动时,通过获取插件的安装目录来找到插件目录的前一个版本(我发现,当插件更新时,旧插件不会立即删除,而是在下一次启动vscode时删除),并从插件的前一版本中复制缓存的数据文件
更多回答
优秀答案推荐
我是一名优秀的程序员,十分优秀!