Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/instance.py
blob: afe69c775dd871a18b02beb20052636a6f5a9a19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os

from sugar import profile
from sugar import util

class Instance:
    key = profile.get_pubkey()
    keyHash = util.sha_data(key)
    
    keyHashPrintable = util.printable_hash(keyHash)
    
    instancePath = None
    savePath = None

    def __init__(self, ca):
        self.__class__.instancePath = os.path.join(ca.get_activity_root(), "instance")
        recreateTmp()
        
    def get_path(self):
        if self.savePath:
            return self.savePath
        return self.instancePath

def recreateTmp():
    if (not os.path.exists(Instance.instancePath)):
        os.makedirs(Instance.instancePath)