Skip to content

Commit b0514b2

Browse files
committed
Add Windows program model
1 parent 147c0ab commit b0514b2

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

src/windows/WindowsProgram.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package windows;
2+
3+
import java.nio.file.Path;
4+
import java.util.ArrayList;
5+
import java.util.List;
6+
7+
/** Describes a Windows executable or command without executing it. */
8+
public record WindowsProgram(String name, Path executable) {
9+
public WindowsProgram {
10+
if (name == null || name.isBlank()) throw new IllegalArgumentException("name is required");
11+
if (executable == null) throw new IllegalArgumentException("executable is required");
12+
}
13+
14+
public List<String> command(List<String> arguments) {
15+
List<String> command = new ArrayList<>();
16+
command.add(executable.toString());
17+
command.addAll(arguments);
18+
return List.copyOf(command);
19+
}
20+
}

0 commit comments

Comments
 (0)