Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Commit

Permalink
lib/init/grass: Refuse to start if ~/.grass7 exists but is not a dire…
Browse files Browse the repository at this point in the history
…ctory
  • Loading branch information
pmav99 committed Mar 17, 2019
1 parent 7229f5f commit 1809611
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/init/grass.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
from __future__ import print_function
import sys
import os
import errno
import atexit
import gettext
import shutil
Expand Down Expand Up @@ -384,12 +385,12 @@ def get_grass_config_dir():
else:
grass_config_dirname = ".grass7"
directory = os.path.join(os.getenv('HOME'), grass_config_dirname)
if not os.path.exists(directory):
if not os.path.isdir(directory) :
try:
os.mkdir(directory)
except OSError as e:
# Can happen as a race condition
if not e.errno == 17:
if not e.errno == errno.EEXIST or not os.path.isdir(directory):
fatal(
_("Failed to create configuration directory '%s' with error: %s")
% (directory, e.strerror))
Expand Down

0 comments on commit 1809611

Please sign in to comment.