z1dev / zkanji

Japanese language study suite and dictionary
GNU General Public License v3.0
59 stars 10 forks source link

Create data folder automatically if it does not exist #32

Open mxmlnkn opened 4 years ago

mxmlnkn commented 4 years ago

First, thanks for your work! I used ZKanji a long time on Windows and even a while using wine under Linux but after the last Linux reinstall and because I'm now also a Qt developer, I wanted to give building this Qt version from source a try. I especially like and frequently use the freehand drawing kanji lookup and that it comes with a built-in Japanese IME for the dictionary lookup.

I followed the build instruction like this:

git clone https://github.com/z1dev/zkanji.git
cd zkanji
mkdir build
cd build
qmake ../zkanji.pro
make

mkdir importfolder
cd importfolder
wget http://ftp.monash.edu/pub/nihongo/JMdict.gz
wget http://www.edrdg.org/kanjidic/kanjidic.gz
wget http://www.edrdg.org/kanjidic/kanjd212.gz
wget ftp://ftp.monash.edu/pub/nihongo/radkfile.gz
wget ftp://ftp.monash.edu/pub/nihongo/examples.utf.gz
for file in *gz; do
    gzip -d -k "$file"
done
cp ../dataimports/* .

# mkdir data # I forgot this and triggered the misleading error message
./zkanji -ie importfolder

No matter whether I choose portable or normal mode in the popup and no matter what permissions I set for the folder where zkanji resides in, I would always get this message:

File permissions do not allow creating and writing data files in the program's data folder.

Looking at the source code I found out that it checks whether the data folder is writable. But it never tries to check for its existence in the first place nor does it try to create it if it does not exist. Maybe I overlooked some of the instructions, but I think it would be easy to check and try to create the folder as fallback and do the permission check on the parent folder.

z1dev commented 3 years ago

Hi! Sorry for not writing before, but GitHub forgot to notify me of issues posted here apparently for a while now. I haven't seen multiple issues until now.

I'm not working on this project anymore. I wanted to make a full release and maybe add some small adjustments years ago, but for a long time nobody tested zkanji or reported issues, and I didn't want to make a full release of a possibly buggy program, then I moved on.

You are right, zkanji expects the data folder to be already created for it. This is an oversight. I'm not sure if I'll come back to zkanji to fix this (maybe on one weekend) so I can't promise anything.