Skip to content

Commit 855ef04

Browse files
committed
Update run.py
1 parent 6d94741 commit 855ef04

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

mim/commands/run.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ def run(
110110

111111
pkg_root = get_installed_path(package)
112112
possible_prefixes = [
113-
osp.join(pkg_root, '.mim', 'tools/'),
114-
osp.join(pkg_root, 'tools/')
113+
osp.join(pkg_root, '.mim', f'tools{os.sep}'),
114+
osp.join(pkg_root, f'tools{os.sep}')
115115
]
116116
for possible_prefix in possible_prefixes:
117117
if osp.exists(possible_prefix):
@@ -121,15 +121,15 @@ def run(
121121
command_domain = ''
122122
if ':' in command:
123123
split_command = command.split(':')
124-
command_domain = '/'.join(split_command[:-1])
124+
command_domain = os.sep.join(split_command[:-1])
125125
command = split_command[-1]
126126

127127
files = recursively_find(prefix, command + '.py')
128128

129129
if command_domain == '':
130-
suffix = f'/{command}.py'
130+
suffix = f'{os.sep}{command}.py'
131131
else:
132-
suffix = f'/{command_domain}/{command}.py'
132+
suffix = f'{os.sep}{command_domain}{os.sep}{command}.py'
133133
files = [f for f in files if f.endswith(suffix)]
134134

135135
if len(files) == 0:
@@ -142,11 +142,11 @@ def run(
142142
echo_warning(f)
143143

144144
# Use the shortest path
145-
files.sort(key=lambda x: len(x.split('/')))
145+
files.sort(key=lambda x: len(x.split(os.sep)))
146146
echo_warning(f'We are using the script {files[0]}. ')
147147
echo_warning('To use other scripts, you need to use these commands: ')
148148
for f in files[1:]:
149-
cmd = f.split(prefix)[1].split('.')[0].replace('/', ':')
149+
cmd = f.split(prefix)[1].split('.')[0].replace(os.sep, ':')
150150
echo_warning(f'Command for {f}: {cmd}')
151151

152152
script = files[0]

0 commit comments

Comments
 (0)