diff --git a/hamster/__main__.py b/hamster/__main__.py index d978c7e..147d1ce 100644 --- a/hamster/__main__.py +++ b/hamster/__main__.py @@ -1,21 +1,10 @@ -import menu -import os +import config, menu, utils def main(): """ Entry point of the Hamster - menu bar application. """ - # Get the path to the user's home directory - home_dir = os.path.expanduser("~") - - # Create a new directory within the home directory - app_dir = os.path.join(home_dir, "HamsterApp") - os.makedirs(app_dir, exist_ok=True) - - # Specify the path to the properties file within the new directory - properties_file = os.path.join(app_dir, "app.properties") - menu_builder = menu.DynamicMenuApp("JMeter") menu_builder.run() diff --git a/hamster/app.properties b/hamster/app.properties index de5bd4b..b474212 100644 --- a/hamster/app.properties +++ b/hamster/app.properties @@ -1,2 +1,3 @@ [JMETER] -home = /Users/naveenkumar/Tools/apache-jmeter-5.6.2 \ No newline at end of file +home = /Users/naveenkumar/Tools/apache-jmeter-5.6.1 + diff --git a/hamster/config.py b/hamster/config.py index 917dbff..8624c30 100644 --- a/hamster/config.py +++ b/hamster/config.py @@ -3,12 +3,26 @@ import sys import getpass import re +import shutil + + +# Get the path to the user's home directory +home_dir = os.path.expanduser("~") + +# Define the source path (current directory) +source_path = os.path.join(os.path.dirname(sys.argv[0]), 'app.properties') + +# Define the destination path (user's home directory) +destination_path = os.path.join(home_dir, 'app.properties') + +# Use shutil to copy the file +shutil.copy(source_path, destination_path) config_parser = configparser.ConfigParser() -properties_file_path = os.path.join(os.path.dirname(sys.argv[0]), 'app.properties') +properties_file_path = os.path.join(home_dir, 'app.properties') config_parser.read(properties_file_path) -icon_path=os.path.join(os.path.dirname(sys.argv[0]), 'img/hamster.png') +icon_path = os.path.join(os.path.dirname(sys.argv[0]), 'img/hamster.png') username = getpass.getuser() pattern = re.compile("recent_file_.*")