winIDEA SDK
Loading...
Searching...
No Matches
test_read_write.py
# This script is licensed under BSD License, see file LICENSE.txt, or search for `License` in the SDK online help.
#
# (c) TASKING Germany GmbH, 2023
import os
import tempfile
import isystem.connect as ic
winidea_id = ''
def test_readWrite():
connMgr = ic.ConnectionMgr()
# normally, here you would do connection to a remote winIDEA
# for this test, local winIDEA is used
connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
rfCtrl = ic.CRemoteFileController(connMgr)
with tempfile.TemporaryDirectory() as tmpDirPath:
filePath = os.path.join(tmpDirPath, "localFile.txt")
rfCtrl = ic.CRemoteFileController(connMgr)
rfCtrl.readFromRemote("src/main.cpp", filePath)
print(f"Remote file read into: {filePath}")
print(f"Writing local file back to remote 'src/main.cpp'...")
rfCtrl.writeToRemote(filePath, "src/main_write_back.cpp")
if __name__ == "__main__":
test_readWrite()