You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 10, 2024. It is now read-only.
Step - 1:
def change_rx_config_details():
dir_name = os.path.basename(os.getcwd()) # changed
for file in os.listdir(os.getcwd()):
if file == "rxconfig.py":
file_path = os.path.join(os.getcwd(), file)
with open(file_path, "r") as rder:
config = rder.read()
config = config.replace(f"{dir_name}", "app")
with open(file_path, "w") as wter:
wter.write(config)
remove_folder = os.path.join(os.getcwd(), dir_name)
shutil.rmtree(remove_folder)
Step - 2:
def create_src_file_structure():
source = os.path.join(Path(file).parent.parent, "app")
replicate = Path("./app")
def create_dir_file_structure(dir_path: str, key: str, files):
os.makedirs(dir_path,exist_ok=True)
for file in files:
source_path = os.path.join(source, key, file)
replicate_path = os.path.join(dir_path, file)
if os.path.exists(source_path):
with open(source_path, "r") as src_file, open(replicate_path, "w") as dst_file:
dst_file.write(src_file.read())
else:
os.makedirs(os.path.dirname(replicate_path), exist_ok=True) # Create directory if it doesn't exist
with open(replicate_path, "w") as dst_file:
pass # Create an empty file
for key, value in file_structure.items():
if value is not None:
dir_path = os.path.join(replicate, key)
if isinstance(value, list):
create_dir_file_structure(dir_path, key, value)
else:
source_file = os.path.join(source, key)
file_path = os.path.join(replicate, key)
if os.path.exists(source_file):
with open(source_file, "r") as src_file, open(file_path, "w") as dst_file:
dst_file.write(src_file.read())
else:
os.makedirs(os.path.dirname(file_path), exist_ok=True) # Create directory if it doesn't exist
with open(file_path, "w") as dst_file:
pass # Create an empty file
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Step - 1:
def change_rx_config_details():
dir_name = os.path.basename(os.getcwd()) # changed
for file in os.listdir(os.getcwd()):
if file == "rxconfig.py":
file_path = os.path.join(os.getcwd(), file)
with open(file_path, "r") as rder:
config = rder.read()
config = config.replace(f"{dir_name}", "app")
with open(file_path, "w") as wter:
wter.write(config)
remove_folder = os.path.join(os.getcwd(), dir_name)
shutil.rmtree(remove_folder)
Step - 2:
def create_src_file_structure():
source = os.path.join(Path(file).parent.parent, "app")
replicate = Path("./app")
def create_dir_file_structure(dir_path: str, key: str, files):
os.makedirs(dir_path,exist_ok=True)
for file in files:
source_path = os.path.join(source, key, file)
replicate_path = os.path.join(dir_path, file)
if os.path.exists(source_path):
with open(source_path, "r") as src_file, open(replicate_path, "w") as dst_file:
dst_file.write(src_file.read())
else:
os.makedirs(os.path.dirname(replicate_path), exist_ok=True) # Create directory if it doesn't exist
with open(replicate_path, "w") as dst_file:
pass # Create an empty file
for key, value in file_structure.items():
if value is not None:
dir_path = os.path.join(replicate, key)
if isinstance(value, list):
create_dir_file_structure(dir_path, key, value)
else:
source_file = os.path.join(source, key)
file_path = os.path.join(replicate, key)
if os.path.exists(source_file):
with open(source_file, "r") as src_file, open(file_path, "w") as dst_file:
dst_file.write(src_file.read())
else:
os.makedirs(os.path.dirname(file_path), exist_ok=True) # Create directory if it doesn't exist
with open(file_path, "w") as dst_file:
pass # Create an empty file
The text was updated successfully, but these errors were encountered: