summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrahulp132022-02-22 01:38:49 +0530
committerrahulp132022-02-22 01:38:49 +0530
commitb6dcef53727c4a216d7b80d3085c1c0e4651a95a (patch)
treea3ed39f9b0144594367a644176391b49fd950d5a
parent9fcfe12644a7aa88d9f43025eb2065252d4d40e6 (diff)
downloadeSim-b6dcef53727c4a216d7b80d3085c1c0e4651a95a.tar.gz
eSim-b6dcef53727c4a216d7b80d3085c1c0e4651a95a.tar.bz2
eSim-b6dcef53727c4a216d7b80d3085c1c0e4651a95a.zip
Fix crash issue due to recursive file/directory access
-rwxr-xr-xsrc/maker/Maker.py4
-rwxr-xr-xsrc/maker/ModelGeneration.py19
2 files changed, 22 insertions, 1 deletions
diff --git a/src/maker/Maker.py b/src/maker/Maker.py
index 4e71d7fd..f3f8b93e 100755
--- a/src/maker/Maker.py
+++ b/src/maker/Maker.py
@@ -125,6 +125,10 @@ class Maker(QtWidgets.QWidget):
QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel)
if reply == QtWidgets.QMessageBox.Ok:
self.addverilog()
+
+ if self.verilogfile == "":
+ return
+
self.obj_Appconfig.print_info('Add Verilog File Called')
elif reply == QtWidgets.QMessageBox.Cancel:
diff --git a/src/maker/ModelGeneration.py b/src/maker/ModelGeneration.py
index a87a04e1..0a6df82c 100755
--- a/src/maker/ModelGeneration.py
+++ b/src/maker/ModelGeneration.py
@@ -1012,23 +1012,32 @@ and set the load for input ports */
init_path = '../../'
if os.name == 'nt':
init_path = ''
+
includefile = QtCore.QDir.toNativeSeparators(
QtWidgets.QFileDialog.getOpenFileName(
self,
"Open adding other necessary files to be included",
init_path + "home")[0])
+
if includefile == "":
reply = QtWidgets.QMessageBox.critical(
None, "Error Message",
"<b>Error: No File Chosen. Please chose a file</b>",
QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel
)
+
if reply == QtWidgets.QMessageBox.Ok:
self.addfile()
+
+ if includefile == "":
+ return
+
self.obj_Appconfig.print_info('Add Other Files Called')
elif reply == QtWidgets.QMessageBox.Cancel:
self.obj_Appconfig.print_info('No File Chosen')
+ return
+
filename = os.path.basename(includefile)
self.modelpath = self.digital_home + \
"/" + self.fname.split('.')[0] + "/"
@@ -1045,9 +1054,9 @@ and set the load for input ports */
print("Added the File:" + filename)
self.termtitle("Added the File:" + filename)
+
# This function is used to add additional folder required by the verilog
# top module
-
def addfolder(self):
# self.cur_dir = os.getcwd()
print("Adding the folder required by the top level module file")
@@ -1055,23 +1064,31 @@ and set the load for input ports */
init_path = '../../'
if os.name == 'nt':
init_path = '' # noqa:F841
+
includefolder = QtCore.QDir.toNativeSeparators(
QtWidgets.QFileDialog.getExistingDirectory(
self, "open", "home"
)
)
+
if includefolder == "":
reply = QtWidgets.QMessageBox.critical(
None, "Error Message",
"<b>Error: No Folder Chosen. Please chose a folder</b>",
QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel
)
+
if reply == QtWidgets.QMessageBox.Ok:
self.addfolder()
+
+ if includefolder == "":
+ return
+
self.obj_Appconfig.print_info('Add Folder Called')
elif reply == QtWidgets.QMessageBox.Cancel:
self.obj_Appconfig.print_info('No File Chosen')
+ return
self.modelpath = self.digital_home + \
"/" + self.fname.split('.')[0] + "/"