Files
Viper_RegressionTesting/SysLibTest/App/os_backend.vp
T
TermiNexus ee6461be46 chore(comments): Test 仓注释英文化(R11)
把 81 个 .vp 文件的中文 # 注释与三引号文档串改写为简洁英文,每个连续注释块 <=2 行;运行时中文字符串字面量(testcheck.begin/print 等用户可见消息)保持原样。骨架比对 HEAD 与工作区 112 文件漂移 0,全量 77/77 顺序回归通过。
2026-10-05 22:43:38 +08:00

39 lines
1.1 KiB
Plaintext

import t, c
from stdint import *
import platmacro
import os._win32
import os._posix
# =============================================================================
# Workaround: TransPyC mis-resolves package-level os.xxx() calls as a local
# module. Import os._win32 / os._posix here so caller code stays intact.
# =============================================================================
def os_exists(path: str) -> bool:
"""Return whether the file/dir exists."""
if platmacro.IS_WINDOWS:
return os._win32.exists(path)
return os._posix.exists(path)
def os_remove(path: str) -> int:
"""Remove a file. Returns 0 on success, -1 on failure."""
if platmacro.IS_WINDOWS:
return os._win32.remove(path)
return os._posix.remove(path)
def os_isdir(path: str) -> bool:
"""Return whether the path is a directory."""
if platmacro.IS_WINDOWS:
return os._win32.isdir(path)
return os._posix.isdir(path)
def os_getsize(path: str) -> int64:
"""Return file size in bytes, or -1 on failure."""
if platmacro.IS_WINDOWS:
return os._win32.getsize(path)
return os._posix.getsize(path)