Codebase list sugar-read-activity / 82c7e06
Avoid shipping binary uninspectable empty sqlite database. Instead create if in code. This was important for inclusion in Debian. Sebastian Silva authored 8 years ago Gonzalo Odiard committed 8 years ago
2 changed file(s) with 15 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
read_v1.db less more
Binary diff not shown
4444
4545 # Situation 1: DB is non-existent at all
4646 if not os.path.exists(dbpath) and not os.path.exists(olddbpath):
47 try:
48 os.makedirs(dbdir)
49 except:
50 pass
51 shutil.copy(srcpath, dbpath)
47 # in this case, sqlite3 takes care of things
48 conn = sqlite3.connect(dbpath)
49 conn.execute("""
50 CREATE TABLE "bookmarks"(
51 md5 text,
52 page integer,
53 content text,
54 timestamp real,
55 user text,
56 color text,
57 local integer
58 );""")
59 conn.commit()
60 conn.close()
61
5262 return dbpath
5363
5464 # Situation 2: DB is outdated