View | Details | Raw Unified | Return to bug 10817
Collapse All | Expand All

(-)config.py.orig (-2 / +11 lines)
Lines 1-5 Link Here
1
1
2
import pygame
2
import pygame
3
from os.path import basename, dirname, expanduser
4
from os import mkdir
3
5
4
pl1car = "images/cars/bentley/bentleysmall.png"
6
pl1car = "images/cars/bentley/bentleysmall.png"
5
pl1stin = "images/cars/bentley/bentleystin.png"
7
pl1stin = "images/cars/bentley/bentleystin.png"
Lines 36-42 Link Here
36
38
37
players = 1
39
players = 1
38
40
39
configFile = "options"
41
configFile = expanduser("~/.wrw/options")
40
rozmer = 1
42
rozmer = 1
41
xx = [1280, 1024, 800, 640]
43
xx = [1280, 1024, 800, 640]
42
yy = [1024, 768, 600, 480]
44
yy = [1024, 768, 600, 480]
Lines 46-52 Link Here
46
multikola = 3
48
multikola = 3
47
49
48
def readConfig():
50
def readConfig():
49
    source = file(configFile).read()
51
    try:
52
        source = file(configFile).read()
53
    except:
54
        source = file(basename(configFile)).read()
50
    exec source in locals(), globals()
55
    exec source in locals(), globals()
51
56
52
def writeConfig():
57
def writeConfig():
Lines 56-61 Link Here
56
name = %r
61
name = %r
57
multikola = %d
62
multikola = %d
58
""" % (rozmer, zvuky, full, name, multikola)
63
""" % (rozmer, zvuky, full, name, multikola)
64
    try:
65
        mkdir(dirname(configFile), 0700)
66
    except OSError:
67
        pass
59
    output = file(configFile, "w")
68
    output = file(configFile, "w")
60
    output.write(text)
69
    output.write(text)
61
    output.close()
70
    output.close()

Return to bug 10817