Skip to content

Create data folder automatically if it does not exist #32

@mxmlnkn

Description

@mxmlnkn

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions