Changeset 3518:74625069fe09 in orange


Ignore:
Timestamp:
04/11/07 10:02:22 (7 years ago)
Author:
Gregor <Gregor@…>
Branch:
default
Convert:
1eec63e846df5fe58ed30724568372d642c05556
Message:
  • bug fix for vista: vista uses roaming profiles. python return that a folder does not exist, but when you try to create it, you get an exception that it already exists.
Location:
orange
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeCanvas/orngRegistry.py

    r3512 r3518  
    206206    reportsDir = os.path.join(orangeDir, "report") 
    207207    if not os.path.exists(reportsDir): 
    208         os.mkdir(reportsDir) 
     208        try: os.mkdir(reportsDir)        # Vista has roaming profiles that will say that this folder does not exist and will then fail to create it, because it exists... 
     209        except: pass 
    209210 
    210211    picsDir = os.path.join(widgetDir, "icons") 
     
    215216        applicationDir = os.path.join(user.home, "Application Data") 
    216217        if not os.path.exists(applicationDir): 
    217             os.mkdir(applicationDir) 
     218            try: os.mkdir(applicationDir) 
     219            except: pass 
    218220        outputDir = os.path.join(applicationDir, "Orange")                  # directory for saving settings and stuff 
    219221    else: 
    220222        outputDir = os.path.join(user.home, "Orange")                  # directory for saving settings and stuff 
    221223    if not os.path.exists(outputDir): 
    222         os.mkdir(outputDir) 
     224        try: os.mkdir(outputDir)        # Vista has roaming profiles that will say that this folder does not exist and will then fail to create it, because it exists... 
     225        except: pass 
    223226    outputDir = os.path.join(outputDir, "OrangeCanvas") 
    224227    if not os.path.exists(outputDir): 
    225         os.mkdir(outputDir) 
     228        try: os.mkdir(outputDir)        # Vista has roaming profiles that will say that this folder does not exist and will then fail to create it, because it exists... 
     229        except: pass 
    226230 
    227231    registryFileName = os.path.join(outputDir, "widgetregistry.xml") 
    228232    if not os.path.exists(registryFileName): 
    229233        WidgetsToXML().ParseWidgetRoot(widgetDir, canvasDir) 
    230    
     234 
    231235    return dict([(name, vars()[name]) for name in ["canvasDir", "orangeDir", "widgetDir", "reportsDir", "picsDir", "outputDir", "registryFileName"]]) 
    232236 
  • orange/OrangeWidgets/OWBaseWidget.py

    r3512 r3518  
    111111        else: 
    112112            self.outputDir = os.path.join(user.home, "Orange")                  # directory for saving settings and stuff 
    113         if not os.path.exists(self.outputDir): os.mkdir(self.outputDir) 
     113        if not os.path.exists(self.outputDir): 
     114            try: os.mkdir(self.outputDir)            # Vista has roaming profiles that will say that this folder does not exist and will then fail to create it, because it exists... 
     115            except: pass 
    114116        self.outputDir = os.path.join(self.outputDir, "widgetSettings") 
    115         if not os.path.exists(self.outputDir): os.mkdir(self.outputDir) 
     117        if not os.path.exists(self.outputDir): 
     118            try: os.mkdir(self.outputDir)            # Vista has roaming profiles that will say that this folder does not exist and will then fail to create it, because it exists... 
     119            except: pass 
    116120 
    117121        self.loadContextSettings() 
Note: See TracChangeset for help on using the changeset viewer.