Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code flexibility for future changes #5

Closed
mingming-ma opened this issue Sep 15, 2023 · 1 comment
Closed

Code flexibility for future changes #5

mingming-ma opened this issue Sep 15, 2023 · 1 comment

Comments

@mingming-ma
Copy link

textml/main.py

Lines 15 to 24 in 293683d

def defaultDirSetup():
if os.path.isdir("textml"): # Check if output dir exists
oldFiles = os.listdir("textml") # Removing each file in dir before deleting
if len(oldFiles) > 0:
for file in oldFiles:
os.remove("textml/" + file)
os.rmdir('textml') # Removing directory
os.mkdir('textml') # Recreating directory

Here, we can change the 'textml' to a variable that holds that value for easy configuration and adaptation to different scenarios or user requirements.

@ijacobs-cpa
Copy link
Owner

Added and tested the updated defaultDirSetup for accepting different output directories.

textml/main.py

Lines 15 to 24 in 7b019c5

def defaultDirSetup(dir):
if os.path.isdir(dir): # Check if output dir exists
oldFiles = os.listdir(dir) # Removing each file in dir before deleting
if len(oldFiles) > 0:
for file in oldFiles:
os.remove(dir + "/" + file)
os.rmdir('textml') # Removing directory
os.mkdir('textml') # Recreating directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants