mirror of
https://github.com/BetterAndroid/compose-multiplatform-template.git
synced 2025-09-05 10:15:24 +08:00
fix: file encoding for windows and other os
This commit is contained in:
@@ -5,11 +5,11 @@ import json
|
||||
import sys
|
||||
|
||||
def replace_strings_in_file(file_path, replacements):
|
||||
with open(file_path, 'r') as file:
|
||||
with open(file_path, 'r', encoding = 'utf-8') as file:
|
||||
content = file.read()
|
||||
for key, value in replacements.items():
|
||||
content = content.replace(key, value)
|
||||
with open(file_path, 'w') as file:
|
||||
with open(file_path, 'w', encoding = 'utf-8') as file:
|
||||
file.write(content)
|
||||
|
||||
def replace_strings_in_directory(directory, replacements, extensions):
|
||||
@@ -20,7 +20,7 @@ def replace_strings_in_directory(directory, replacements, extensions):
|
||||
replace_strings_in_file(file_path, replacements)
|
||||
|
||||
def main():
|
||||
with open('initializer.json', 'r') as json_file:
|
||||
with open('initializer.json', 'r', encoding = 'utf-8') as json_file:
|
||||
replacements = json.load(json_file)
|
||||
extensions = ('.kt', '.properties', '.xml', '.gradle.kts', '.xcconfig', '.plist')
|
||||
replace_strings_in_directory('.', replacements, extensions)
|
||||
|
Reference in New Issue
Block a user