Skip to content

Commit 31c4101

Browse files
committed
replace schtasks with scheduletask commandlet
mark last few potential legacy commands
1 parent e3ae8e3 commit 31c4101

3 files changed

Lines changed: 22 additions & 5 deletions

File tree

pbpy/pbtools.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ def it_has_all(it, *args):
240240
def whereis(app):
241241
result = None
242242

243+
# todo: do we need a replacement for this?
243244
command = "where"
244245
if os.name != "nt":
245246
command = "which"
@@ -468,11 +469,24 @@ def maintain_repo():
468469

469470
if os.name == "nt" and pbgit.get_git_executable() == "git":
470471
proc = run_with_combined_output(
471-
["schtasks" "/query", "/TN", "Git for Windows Updater"]
472+
[
473+
"powershell",
474+
"-Command",
475+
"Get-ScheduledTask",
476+
"-TaskName",
477+
'"Git for Windows Updater"',
478+
]
472479
)
473480
# if exists
474481
if proc.returncode == 0:
475-
cmdline = ["schtasks", "/delete", "/F", "/TN", '"Git for Windows Updater"']
482+
cmdline = [
483+
"powershell",
484+
"-Command",
485+
"Unregister-ScheduledTask",
486+
"-TaskName",
487+
'"Git for Windows Updater"',
488+
"-Confirm:$false",
489+
]
476490
pblog.info(
477491
"Requesting admin permission to delete the Git for Windows Updater..."
478492
)
@@ -492,9 +506,9 @@ def maintain_repo():
492506
== "hourly"
493507
)
494508
if not does_maintainence:
495-
commands.insert(0, f"scalar register .")
509+
commands.insert(0, "scalar register .")
496510
else:
497-
commands.insert(0, f"scalar reconfigure .")
511+
commands.insert(0, "scalar reconfigure .")
498512

499513
# fill in the git repo optionally
500514
is_shallow = get_one_line_output(

pbpy/pbunreal.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ def uses_longtail():
362362

363363
def check_ue_file_association():
364364
if os.name == "nt":
365+
# todo: do we need a replacement for this?
365366
file_assoc_result = pbtools.get_combined_output(["assoc", uproject_ext])
366367
return "Unreal.ProjectFile" in file_assoc_result
367368
else:
@@ -659,6 +660,7 @@ def get_unreal_version_selector_path():
659660
)
660661
if selector_path.exists():
661662
return selector_path, True
663+
# todo: do we need a replacement for this?
662664
ftype_info = pbtools.get_one_line_output(["ftype", "Unreal.ProjectFile"])
663665
if ftype_info is not None:
664666
ftype_split = ftype_info.split('"')
@@ -1221,6 +1223,7 @@ def get_sln_path():
12211223

12221224
@lru_cache()
12231225
def get_vs_basepath():
1226+
# todo: do we need a replacement for this?
12241227
return pbtools.get_one_line_output(
12251228
[
12261229
"%ProgramFiles(x86)%\\Microsoft Visual Studio\\Installer\\vswhere.exe",

pbsync/actions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from pbpy import pbconfig, pbgh, pbgit, pblog, pbtools, pbunreal
77
from pbsync import prereqs
88

9-
109
actions = {}
1110
action_pairs = {}
1211
active_pairs = {}
@@ -304,6 +303,7 @@ def launch_project():
304303
os.startfile(pbunreal.get_sln_path())
305304
elif launch_pref == "rider":
306305
pblog.info("Launching Rider...")
306+
# todo: do we need a replacement for this?
307307
rider_bin = pbtools.get_one_line_output(["echo", "%Rider for Unreal Engine%"])
308308
rider_bin = rider_bin.replace(";", "")
309309
rider_bin = rider_bin.replace('"', "")

0 commit comments

Comments
 (0)