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

Fix flatten folders option #58

Merged
merged 3 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pathlib

PROGRAM_NAME = "Start Menu Helper"
VERSION_NUMBER = "1.1.4"
VERSION_NUMBER = "1.1.5"
ICON_FILE_NAME = "icon.ico"
TIME_BETWEEN_SCANS_IN_MINUTES = 5
APP_DATA_PATH = pathlib.WindowsPath.home().joinpath("AppData")
Expand Down
21 changes: 14 additions & 7 deletions library/start_menu_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,14 @@ def flatten_folders_with_whitelist() -> None:
nested_directories = get_nested_directories(path)
nested_directories.reverse() # Reverse the list to flatten the deepest folders first
for directory in nested_directories:
if (directory.name in whitelist and
directory.name not in constants.PROTECTED_FOLDERS):
for item in directory.iterdir():
item.replace(path.joinpath(item.name))
logging.info(f"Flattened folder: {str(directory)}")
if directory.name in constants.PROTECTED_FOLDERS:
continue
for word in whitelist:
if word in directory.name:
for item in directory.iterdir():
item.replace(path.joinpath(item.name))
logging.info(f"Flattened folder: {str(directory)}")
break


def flatten_folders_with_blacklist() -> None:
Expand All @@ -141,8 +144,12 @@ def flatten_folders_with_blacklist() -> None:
nested_directories = get_nested_directories(path)
nested_directories.reverse() # Reverse the list to flatten the deepest folders first
for directory in nested_directories:
if (directory.name not in blacklist and
directory.name not in constants.PROTECTED_FOLDERS):
if directory.name in constants.PROTECTED_FOLDERS:
continue
for word in blacklist:
if word in directory.name:
break
else:
for item in directory.iterdir():
item.replace(path.joinpath(item.name))
logging.info(f"Flattened folder: {str(directory)}")
Expand Down
2 changes: 1 addition & 1 deletion scripts/setup_script.iss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; This file is a script for generating the setup of the app using Inno Setup (http://www.jrsoftware.org/isinfo.php)
#define MyAppName "Start Menu Helper"
#define MyAppVersion "1.1.4"
#define MyAppVersion "1.1.5"
#define MyAppPublisher "Jarik Marwede"
#define MyAppURL "https://github.com/jarikmarwede/Start-Menu-Helper"
#define MyAppExeName "Start Menu Helper.exe"
Expand Down
Loading