From b6dcef53727c4a216d7b80d3085c1c0e4651a95a Mon Sep 17 00:00:00 2001
From: rahulp13
Date: Tue, 22 Feb 2022 01:38:49 +0530
Subject: Fix crash issue due to recursive file/directory access
---
src/maker/Maker.py | 4 ++++
src/maker/ModelGeneration.py | 19 ++++++++++++++++++-
2 files changed, 22 insertions(+), 1 deletion(-)
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",
"Error: No File Chosen. Please chose a file",
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",
"Error: No Folder Chosen. Please chose a folder",
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] + "/"
--
cgit