Small fixes

This commit is contained in:
crschnick 2023-04-12 20:11:40 +00:00
parent edd4656e3a
commit c86cc138c0
5 changed files with 22 additions and 13 deletions

View file

@ -79,7 +79,10 @@ final class FileContextMenu extends ContextMenu {
execute.setOnAction(event -> {
ThreadHelper.runFailableAsync(() -> {
ShellControl pc = model.getFileSystem().getShell().orElseThrow();
pc.executeBooleanSimpleCommand(pc.getShellDialect().getMakeExecutableCommand(entry.getPath()));
var e = pc.getShellDialect().getMakeExecutableCommand(entry.getPath());
if (e != null) {
pc.executeBooleanSimpleCommand(e);
}
var cmd = pc.command("\"" + entry.getPath() + "\"").prepareTerminalOpen();
TerminalHelper.open(FilenameUtils.getBaseName(entry.getPath()), cmd);
});
@ -91,7 +94,10 @@ final class FileContextMenu extends ContextMenu {
executeInBackground.setOnAction(event -> {
ThreadHelper.runFailableAsync(() -> {
ShellControl pc = model.getFileSystem().getShell().orElseThrow();
pc.executeBooleanSimpleCommand(pc.getShellDialect().getMakeExecutableCommand(entry.getPath()));
var e = pc.getShellDialect().getMakeExecutableCommand(entry.getPath());
if (e != null) {
pc.executeBooleanSimpleCommand(e);
}
var cmd = ScriptHelper.createDetachCommand(pc, "\"" + entry.getPath() + "\"");
pc.executeBooleanSimpleCommand(cmd);
});

View file

@ -23,7 +23,6 @@ public class SentryErrorHandler {
options.setEnableUncaughtExceptionHandler(false);
options.setAttachServerName(false);
// options.setDebug(true);
options.setDist(XPipeDistributionType.get().getId());
options.setRelease(AppProperties.get().getVersion());
options.setEnableShutdownHook(false);
options.setProguardUuid(AppProperties.get().getBuildUuid().toString());
@ -87,6 +86,7 @@ public class SentryErrorHandler {
.toList();
atts.forEach(attachment -> s.addAttachment(attachment));
s.setTag("dist", XPipeDistributionType.get().getId());
s.setTag("developerMode", AppPrefs.get() != null ? AppPrefs.get().developerMode().getValue().toString() : "false");
s.setTag("terminal", Boolean.toString(ee.isTerminal()));
s.setTag("omitted", Boolean.toString(ee.isOmitted()));

View file

@ -98,8 +98,10 @@ public class ScriptHelper {
// processControl.executeSimpleCommand(type.getFileTouchCommand(file), "Failed to create script " + file);
processControl.getShellDialect().createTextFileWriteCommand(processControl, content, file).execute();
processControl.executeSimpleCommand(
type.getMakeExecutableCommand(file), "Failed to make script " + file + " executable");
var e = type.getMakeExecutableCommand(file);
if (e != null) {
processControl.executeSimpleCommand(e, "Failed to make script " + file + " executable");
}
return file;
}

View file

@ -15,8 +15,7 @@ import java.util.function.Consumer;
public class JacksonMapper {
private static final ObjectMapper BASE = new ObjectMapper();
private static final ObjectMapper DEFAULT;
private static ObjectMapper INSTANCE = new ObjectMapper();
private static final ObjectMapper INSTANCE;
private static boolean init = false;
public static <T> T parse(String s, Class<T> c) throws JsonProcessingException {
@ -40,11 +39,7 @@ public class JacksonMapper {
.withCreatorVisibility(JsonAutoDetect.Visibility.NONE)
.withIsGetterVisibility(JsonAutoDetect.Visibility.NONE));
var modules = findModules(ModuleLayer.boot());
objectMapper.registerModules(modules);
INSTANCE = BASE.copy();
DEFAULT = BASE.copy();
}
public static synchronized void configure(Consumer<ObjectMapper> mapper) {
@ -76,15 +71,17 @@ public class JacksonMapper {
*/
public static ObjectMapper newMapper() {
if (!JacksonMapper.isInit()) {
return DEFAULT;
return BASE;
}
return INSTANCE.copy();
}
public static ObjectMapper getDefault() {
if (!JacksonMapper.isInit()) {
return DEFAULT;
return BASE;
}
return INSTANCE;
}

View file

@ -23,6 +23,10 @@ public class DeleteStoreChildrenAction implements ActionProvider {
@Override
public void execute() throws Exception {
DataStorage.get().getStoreChildren(store,true).forEach(entry -> {
if (!entry.getConfiguration().isDeletable()) {
return;
}
DataStorage.get().deleteStoreEntry(entry);
});
}