mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-04-19 14:33:04 +03:00
[FIX] Исправил clear из консоли лаунчера.
This commit is contained in:
parent
f0c6c75b14
commit
e0c6874751
3 changed files with 17 additions and 3 deletions
|
@ -130,6 +130,9 @@ function initConsoleScene() {
|
|||
var appendFunction = function(line) javafx.application.Platform.runLater(function() output.appendText(line));
|
||||
consoleMenu.lookup("#send").setOnAction(function(){
|
||||
execCommand(text.getText());
|
||||
if (text.getText()=="clear") {
|
||||
output.setText("");
|
||||
}
|
||||
text.setText("");
|
||||
});
|
||||
FunctionalBridge.addPlainOutput(function(string) {
|
||||
|
|
|
@ -153,5 +153,5 @@ public List<Category> getCategories() {
|
|||
public abstract void bell() throws IOException;
|
||||
|
||||
|
||||
public abstract void clear() throws IOException;
|
||||
public abstract void clear() throws IOException, InterruptedException;
|
||||
}
|
||||
|
|
|
@ -18,8 +18,19 @@ public void bell() {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
throw new UnsupportedOperationException("clear terminal");
|
||||
public void clear() throws IOException, InterruptedException {
|
||||
//throw new UnsupportedOperationException("clear terminal");
|
||||
String os = System.getProperty("os.name");
|
||||
|
||||
if (os.contains("Windows"))
|
||||
{
|
||||
|
||||
new ProcessBuilder("cmd", "/c", "cls").inheritIO().start().waitFor();
|
||||
}
|
||||
else
|
||||
{
|
||||
Runtime.getRuntime().exec("clear");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue