Files
DocumentServer-v-9.2.0/core/Common/js/common.py
Yajbir Singh f1b860b25c
Some checks failed
check / markdownlint (push) Has been cancelled
check / spellchecker (push) Has been cancelled
updated
2025-12-11 19:03:17 +05:30

25 lines
713 B
Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
sys.path.append("./../../../build_tools/scripts")
import base
import os
def apply_patch(file, patch):
patch_content = base.readFile(patch)
index1 = patch_content.find("<<<<<<<")
index2 = patch_content.find("=======")
index3 = patch_content.find(">>>>>>>")
file_content_old = patch_content[index1 + 7:index2].strip()
file_content_new = patch_content[index2 + 7:index3].strip()
#file_content_new = "\n#if 0" + file_content_old + "#else" + file_content_new + "#endif\n"
base.replaceInFile(file, file_content_old, file_content_new)
return
def clear_dir(dir):
if base.is_dir(dir):
base.delete_dir(dir)
base.create_dir(dir)
return