Skip to content

Commit

Permalink
Disable drawio by default
Browse files Browse the repository at this point in the history
  • Loading branch information
K0R0L committed Jan 26, 2024
1 parent 181a42e commit 2a8c5ea
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
4 changes: 2 additions & 2 deletions defaults
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
sdkjs-plugin="photoeditor, macros, ocr, translator, thesaurus, youtube, highlightcode, drawio, zotero"
sdkjs-plugin-server="speech, zotero, mendeley, speechrecognition"
sdkjs-plugin="photoeditor, macros, ocr, translator, thesaurus, youtube, highlightcode, zotero"
sdkjs-plugin-server="speech, zotero, mendeley, speechrecognition, drawio"
sdkjs-addons="sdkjs-forms"
42 changes: 26 additions & 16 deletions scripts/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,17 +292,34 @@ def copy_exe(src, dst, name):
copy_file(src + "/" + name + exe_ext, dst + "/" + name + exe_ext)
return

def readFileCommon(path):
file_data = ""
try:
with open(get_path(path), "r") as file:
file_data = file.read()
except Exception as e:
with open(get_path(path), "r", encoding="utf-8") as file:
file_data = file.read()
return file_data

def writeFileCommon(path, data):
file_data = ""
try:
with open(get_path(path), "w") as file:
file.write(data)
except Exception as e:
with open(get_path(path), "w", encoding="utf-8") as file:
file.write(data)
return

def replaceInFile(path, text, textReplace):
if not is_file(path):
print("[replaceInFile] file not exist: " + path)
return
filedata = ""
with open(get_path(path), "r") as file:
filedata = file.read()
filedata = readFileCommon(path)
filedata = filedata.replace(text, textReplace)
delete_file(path)
with open(get_path(path), "w") as file:
file.write(filedata)
writeFileCommon(path, filedata)
return
def replaceInFileUtf8(path, text, textReplace):
if not is_file(path):
Expand All @@ -320,28 +337,21 @@ def replaceInFileRE(path, pattern, textReplace):
if not is_file(path):
print("[replaceInFile] file not exist: " + path)
return
filedata = ""
with open(get_path(path), "r") as file:
filedata = file.read()
filedata = readFileCommon(path)
filedata = re.sub(pattern, textReplace, filedata)
delete_file(path)
with open(get_path(path), "w") as file:
file.write(filedata)
writeFileCommon(path, filedata)
return

def readFile(path):
if not is_file(path):
return ""
filedata = ""
with open(get_path(path), "r") as file:
filedata = file.read()
return filedata
return readFileCommon(path)

def writeFile(path, data):
if is_file(path):
delete_file(path)
with open(get_path(path), "w") as file:
file.write(data)
writeFileCommon(path, data)
return

# system cmd methods ------------------------------------
Expand Down

0 comments on commit 2a8c5ea

Please sign in to comment.