Remove scripts.
This commit is contained in:
parent
6d70309136
commit
5d305e7d78
|
@ -1,27 +0,0 @@
|
||||||
import os
|
|
||||||
import shutil
|
|
||||||
|
|
||||||
def replace_symlinks_with_real_files(folder_path):
|
|
||||||
# Stage 1: Replace symbolic links with real files for files
|
|
||||||
for root, _, files in os.walk(folder_path):
|
|
||||||
for filename in files:
|
|
||||||
file_path = os.path.join(root, filename)
|
|
||||||
if os.path.islink(file_path):
|
|
||||||
real_path = os.path.realpath(file_path)
|
|
||||||
os.unlink(file_path) # Remove the symbolic link
|
|
||||||
shutil.copy(real_path, file_path) # Replace with the real file
|
|
||||||
|
|
||||||
# Stage 2: Replace symbolic links with real files for folders
|
|
||||||
for root, dirs, _ in os.walk(folder_path, topdown=False):
|
|
||||||
for dirname in dirs:
|
|
||||||
dir_path = os.path.join(root, dirname)
|
|
||||||
if os.path.islink(dir_path):
|
|
||||||
real_path = os.path.realpath(dir_path)
|
|
||||||
os.unlink(dir_path) # Remove the symbolic link (empty directory)
|
|
||||||
shutil.copytree(real_path, dir_path) # Replace with the real directory
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
folder_path = "/home/dismine/CAD/Valentina_0.7.x/valentina/src/libs/vmisc/share/resources/icons/La-Sierra-Light" # Replace this with the folder you want to scan
|
|
||||||
replace_symlinks_with_real_files(folder_path)
|
|
||||||
|
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
import os
|
|
||||||
|
|
||||||
def traverse_directory(root_dir, relative_dir="", file_list=[]):
|
|
||||||
current_path = os.path.join(root_dir, relative_dir)
|
|
||||||
for entry in os.listdir(current_path):
|
|
||||||
entry_path = os.path.join(current_path, entry)
|
|
||||||
relative_path = os.path.join(relative_dir, entry)
|
|
||||||
if os.path.isdir(entry_path):
|
|
||||||
traverse_directory(root_dir, relative_path, file_list)
|
|
||||||
else:
|
|
||||||
file_list.append(relative_path)
|
|
||||||
|
|
||||||
def generate_qrc_file(icon_theme_dir, root_folder, qrc_filename):
|
|
||||||
file_list = []
|
|
||||||
traverse_directory(icon_theme_dir, "", file_list)
|
|
||||||
|
|
||||||
qrc_content = f'<RCC>\n <qresource prefix="/">\n'
|
|
||||||
for file_path in file_list:
|
|
||||||
qrc_content += f' <file>{root_folder}{file_path}</file>\n'
|
|
||||||
qrc_content += ' </qresource>\n</RCC>'
|
|
||||||
|
|
||||||
with open(qrc_filename, 'w', encoding='utf-8') as qrc_file:
|
|
||||||
qrc_file.write(qrc_content)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
root_folder = "icons/La-Sierra-Dark/"
|
|
||||||
icon_theme_directory = "/home/dismine/CAD/Valentina_0.7.x/valentina/src/libs/vmisc/share/resources/icons/La-Sierra-Dark"
|
|
||||||
qrc_file_name = "mac_dark_theme.qrc"
|
|
||||||
|
|
||||||
generate_qrc_file(icon_theme_directory, root_folder, qrc_file_name)
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user