Skip to content

Commit 0dfbd94

Browse files
committed
fix: change detection of win32
1 parent 9c38d93 commit 0dfbd94

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

packages/core/src/robotcode/core/ignore_spec.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import re
3+
import sys
34
from pathlib import Path, PurePath
45
from typing import Dict, Iterable, Iterator, NamedTuple, Optional, Reversible, Tuple
56

@@ -269,7 +270,7 @@ def _is_hidden(entry: Path) -> bool:
269270
if entry.name.startswith("."):
270271
return True
271272

272-
if os.name == "nt" and (
273+
if sys.platform == "win32" and (
273274
(not entry.is_symlink() and entry.stat().st_file_attributes & _FILE_ATTRIBUTE_HIDDEN != 0)
274275
or entry.name.startswith("$")
275276
):

packages/core/src/robotcode/core/uri.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
import os
44
import re
5+
import sys
56
from dataclasses import astuple, dataclass, fields
67
from pathlib import Path
78
from typing import Any, Iterator, Mapping, Optional, Union, overload
89
from urllib import parse
910

1011
from .utils.path import normalized_path
1112

12-
_IS_WIN = os.name == "nt"
13+
_IS_WIN = sys.platform == "win32"
1314

1415
_RE_DRIVE_LETTER_PATH = re.compile(r"^\/[a-zA-Z]:")
1516

packages/core/src/robotcode/core/utils/glob_path.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import functools
22
import os
33
import re
4+
import sys
45
from pathlib import Path, PurePath
56
from typing import Any, Iterable, Iterator, Optional, Sequence, Union, cast
67

@@ -109,7 +110,7 @@ def _is_hidden(entry: os.DirEntry[str]) -> bool:
109110
if entry.name.startswith("."):
110111
return True
111112

112-
if os.name == "nt" and (
113+
if sys.platform == "win32" and (
113114
(not entry.is_symlink() and entry.stat().st_file_attributes & 2 != 0) or entry.name.startswith("$")
114115
):
115116
return True

packages/core/src/robotcode/core/utils/path.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import re
3+
import sys
34
from pathlib import Path
45
from typing import Any, Union
56

@@ -21,7 +22,7 @@ def path_is_relative_to(
2122
def normalized_path(path: Union[Path, str, "os.PathLike[Any]"]) -> Path:
2223
p = os.path.normpath(os.path.abspath(path))
2324

24-
if os.name == "nt" and _RE_DRIVE_LETTER_PATH.match(str(p)):
25+
if sys.platform == "win32" and _RE_DRIVE_LETTER_PATH.match(str(p)):
2526
return Path(p[0].upper() + p[1:])
2627

2728
return Path(p)

0 commit comments

Comments
 (0)