From d4386f27a746d8508a1e4770441011183b128149 Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Sun, 20 Feb 2022 22:47:34 +0530 Subject: Resolves HOME path issue on Windows OS --- src/Appconfig.py | 6 +++++- src/model_generation.py | 7 ++++++- src/ngspice_ghdl.py | 6 +++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Appconfig.py b/src/Appconfig.py index 9789d2c..d03dcc3 100755 --- a/src/Appconfig.py +++ b/src/Appconfig.py @@ -3,7 +3,11 @@ from configparser import ConfigParser class Appconfig: - home = os.path.expanduser("~") + if os.name == 'nt': + home = os.path.join('library', 'config') + else: + home = os.path.expanduser('~') + # Reading all variables from eSim config.ini parser_esim = ConfigParser() parser_esim.read(os.path.join(home, os.path.join('.esim', 'config.ini'))) diff --git a/src/model_generation.py b/src/model_generation.py index 5e8684e..7342eef 100755 --- a/src/model_generation.py +++ b/src/model_generation.py @@ -11,7 +11,12 @@ class ModelGeneration: print("Arguement is : ", file) self.fname = os.path.basename(file) print("VHDL filename is : ", self.fname) - self.home = os.path.expanduser("~") + + if os.name == 'nt': + self.home = os.path.join('library', 'config') + else: + self.home = os.path.expanduser('~') + self.parser = ConfigParser() self.parser.read(os.path.join( self.home, os.path.join('.nghdl', 'config.ini'))) diff --git a/src/ngspice_ghdl.py b/src/ngspice_ghdl.py index 329329f..97f1d06 100755 --- a/src/ngspice_ghdl.py +++ b/src/ngspice_ghdl.py @@ -20,7 +20,11 @@ class Mainwindow(QtWidgets.QWidget): QtWidgets.QMainWindow.__init__(self) print("Initializing..........") - self.home = os.path.expanduser("~") + if os.name == 'nt': + self.home = os.path.join('library', 'config') + else: + self.home = os.path.expanduser('~') + # Reading all variables from config.ini self.parser = ConfigParser() self.parser.read( -- cgit