Ben-Kerman / immersive

Language learning mpv script for looking up words within mpv and generating Anki cards
GNU General Public License v3.0
81 stars 1 forks source link

Immersive is creating the "immersive-data/dict-cache" directory in the directory of the video file after updating to version 1.3 #17

Closed sbstratos79 closed 3 years ago

sbstratos79 commented 3 years ago

I updated to version 1.3, in hopes that it would fix issue #16 . Unfortunately, it didn't and instead a new issue has cropped up. I have stored the mpv folder in D:\Program Files\mpv. Since there's a space in the directory path, I think it is causing immersive to create a directory in the wrong location. Every time I run immersive and use the dictionary, it tries to create a cache, and in doing so just creates an empty folder called Program in D drive and Files\mpv\portable_config\immersive-data\dict-cache folder in the directory containing the video file.

Here's a snippet of the log.

[immersive] A subdirectory or file D:\Program already exists. [immersive] Error occurred while processing: D:\Program. [immersive] A subdirectory or file Files\mpv\portable_config\immersive-data\dict-cache already exists. [immersive] Error occurred while processing: Files\mpv\portable_config\immersive-data\dict-cache. [immersive] failed to create dictionary cache directory

sbstratos79 commented 3 years ago

I checked the code in util.lua and I think it has something to do with it.

Old code: local cache_dir = mpu.join_path(config_dir, script_name .. "-dict-cache")

New code: local cache_dir = mpu.join_path(cfg.cfg_dir, script_name .. "-data/dict-cache")

sbstratos79 commented 3 years ago

This fix was provided by Ben. For the cache dir issue try replacing this line in systems/system.lua: args = {"cmd", "/d", "/c", "mkdir", (path:gsub("/", "\""))} With this: args = {"cmd", "/d", "/c", "mkdir", (path:gsub("/", "\\"))}