20 lines
649 B
Python
20 lines
649 B
Python
import io
|
|
p = r'C:\Users\locpham\SonicForgeStudio\native_bridge\src\gui_probe.cpp'
|
|
s = io.open(p, encoding='utf-8', newline='').read()
|
|
def crlf(x): return x.replace('\n', '\r\n')
|
|
|
|
old = crlf(''' th = std::thread([this] {
|
|
#ifdef _WIN32
|
|
CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
|
|
#endif''')
|
|
new = crlf(''' th = std::thread([this] {
|
|
#ifdef _WIN32
|
|
_set_invalid_parameter_handler(probe_invalid_param);
|
|
CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
|
|
#endif''')
|
|
n = s.count(old)
|
|
print('match:', n)
|
|
s = s.replace(old, new)
|
|
io.open(p, 'w', encoding='utf-8', newline='').write(s)
|
|
print('written')
|