Skip to content

Commit 247168b

Browse files
committed
Added environment variable support in all path-related actions
1 parent 32f95aa commit 247168b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

AssistantComputerControl/Actions.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ public void KeyShortcut(string parameter) {
616616
}
617617

618618
public void CreateFile(string parameter) {
619-
string fileLocation = parameter;
619+
string fileLocation = ActionChecker.CheckForEnvironmentPath(parameter);
620620
if (!File.Exists(fileLocation)) {
621621
string parentPath = Path.GetDirectoryName(fileLocation);
622622
if (Directory.Exists(parentPath)) {
@@ -657,7 +657,7 @@ public void CreateFile(string parameter) {
657657
}
658658
}
659659
public void DeleteFile(string parameter) {
660-
string fileLocation = parameter;
660+
string fileLocation = ActionChecker.CheckForEnvironmentPath(parameter);
661661
if (File.Exists(fileLocation) || Directory.Exists(fileLocation)) {
662662
FileAttributes attr = File.GetAttributes(fileLocation);
663663
bool succeeded = true;
@@ -725,7 +725,7 @@ public void DeleteFile(string parameter) {
725725
}
726726
}
727727
public void AppendText(string parameter) {
728-
string fileLocation = ActionChecker.GetSecondaryParam(parameter)[0],
728+
string fileLocation = ActionChecker.CheckForEnvironmentPath(ActionChecker.GetSecondaryParam(parameter)[0]),
729729
toAppend = ActionChecker.GetSecondaryParam(parameter).Length > 1 ? ActionChecker.GetSecondaryParam(parameter)[1] : null;
730730

731731
MainProgram.DoDebug("Appending \"" + toAppend + "\" to " + fileLocation);
@@ -843,8 +843,8 @@ public void KillProcess(string parameter) {
843843
}
844844

845845
public void MoveSubject(string parameter) {
846-
string theSubject = ActionChecker.GetSecondaryParam(parameter)[0],
847-
moveTo = (ActionChecker.GetSecondaryParam(parameter).Length > 1 ? ActionChecker.GetSecondaryParam(parameter)[1] : null);
846+
string theSubject = ActionChecker.CheckForEnvironmentPath(ActionChecker.GetSecondaryParam(parameter)[0]),
847+
moveTo = ActionChecker.CheckForEnvironmentPath((ActionChecker.GetSecondaryParam(parameter).Length > 1 ? ActionChecker.GetSecondaryParam(parameter)[1] : null));
848848

849849
FileAttributes attr = FileAttributes.Normal; //Has to have a default value
850850
bool subjectExists = true;

0 commit comments

Comments
 (0)