Prechádzať zdrojové kódy

v.db.reconnect.all: fix default SQLite settings (see `db.connect -c`)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@53972 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 12 rokov pred
rodič
commit
392b778904

+ 2 - 2
scripts/v.db.reconnect.all/v.db.reconnect.all.html

@@ -53,7 +53,7 @@ to <a href="grass-sqlite.html">SQLite</a> database:
 
 <div class="code"><pre>
 v.db.reconnect.all old_database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/' \
- new_driver=sqlite new_database='$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite.db'
+ new_driver=sqlite new_database='$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db'
 </pre></div>
 
 If attribute table doesn't exist in the target database
@@ -66,7 +66,7 @@ vector maps in the current mapset must be defined also <b>-c</b> flag.
 
 <div class="code"><pre>
 v.db.reconnect.all -c old_database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/' \
- new_driver=sqlite new_database='$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite.db'
+ new_driver=sqlite new_database='$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db'
 </pre></div>
 
 To automatically remove original DBF attribute tables after

+ 6 - 0
scripts/v.db.reconnect.all/v.db.reconnect.all.py

@@ -68,6 +68,12 @@ def substitute_db(database):
 
 # create database if doesn't exist
 def create_db(driver, database):
+    if driver == 'sqlite':
+        path = os.path.dirname(database)
+        # check if destination directory exists
+        if not os.path.isdir(path):
+            os.makedirs(path)
+    
     if database in grass.read_command('db.databases', quiet = True,
                                       driver = driver).splitlines():
         return False