mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-15 19:44:29 +05:00
fix: Path.rename() not working across devices (#584)
causes `[Errno 18] Invalid cross-device link` on tmpfs filesystems Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List, Tuple
|
from typing import List, Tuple
|
||||||
@@ -69,7 +70,7 @@ def add_config_section_at_top(section: str, instances: List[InstanceType]) -> No
|
|||||||
tmp.writelines(org_content)
|
tmp.writelines(org_content)
|
||||||
|
|
||||||
cfg_file.unlink()
|
cfg_file.unlink()
|
||||||
tmp_cfg_path.rename(cfg_file)
|
shutil.move(tmp_cfg_path, cfg_file)
|
||||||
|
|
||||||
Logger.print_ok("OK!")
|
Logger.print_ok("OK!")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user