Skip to content

Commit

Permalink
Updated
Browse files Browse the repository at this point in the history
Fixed problem were previously saved default folder no longer exists
  • Loading branch information
C4J committed Jul 24, 2024
1 parent 3b65f93 commit e9e2342
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
Binary file modified Tree.jar
Binary file not shown.
7 changes: 4 additions & 3 deletions TreeDoc.install4j
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<install4j version="10.0.8" transformSequenceNumber="10">
<directoryPresets config="." />
<application name="Tree Documentor" applicationId="4497-8992-4017-3453" mediaDir="../../../Distribution/java17/b6TreeDoc" lzmaCompression="true" shortName="TreeDoc" publisher="David Garratt" publisherWeb="https://www.commander4j.com" version="1.10" allPathsRelative="true" macVolumeId="6b86ee16dd00bf3f">
<application name="Tree Documentor" applicationId="4497-8992-4017-3453" mediaDir="../../../Distribution/java17/b6TreeDoc" lzmaCompression="true" shortName="TreeDoc" publisher="David Garratt" publisherWeb="https://www.commander4j.com" version="1.11" allPathsRelative="true" macVolumeId="6b86ee16dd00bf3f">
<languages skipLanguageSelection="true">
<additionalLanguages>
<language id="cs" />
Expand All @@ -21,21 +21,21 @@
</application>
<files defaultOverwriteMode="1" defaultUninstallMode="2">
<mountPoints>
<mountPoint id="24" />
<mountPoint id="42" location="lib" />
<mountPoint id="43" location="xml" />
<mountPoint id="44" location="xml/config" />
<mountPoint id="45" location="Images" />
<mountPoint id="24" />
</mountPoints>
<entries>
<fileEntry mountPoint="24" file="./Tree.jar" />
<dirEntry mountPoint="42" file="./lib" overwriteMode="1" uninstallMode="2" overrideOverwriteMode="true" overrideUninstallMode="true" subDirectory="lib" />
<dirEntry mountPoint="44" file="./xml/config" overwriteMode="0" uninstallMode="1" overrideOverwriteMode="true" overrideUninstallMode="true" subDirectory="config" />
<dirEntry mountPoint="45" file="./Images" overwriteMode="1" uninstallMode="2" overrideOverwriteMode="true" overrideUninstallMode="true" subDirectory="Images">
<exclude>
<entry location=".DS_Store" />
</exclude>
</dirEntry>
<fileEntry mountPoint="24" file="./Tree.jar" />
</entries>
</files>
<launchers>
Expand Down Expand Up @@ -202,6 +202,7 @@ return console.askOkCancel(message, true);
</screen>
<screen id="15" beanClass="com.install4j.runtime.beans.screens.InstallationScreen" rollbackBarrier="true" rollbackBarrierExitCode="0">
<actions>
<action id="46" beanClass="com.install4j.runtime.beans.actions.UninstallPreviousAction" actionElevationType="none" rollbackBarrierExitCode="0" />
<action id="17" beanClass="com.install4j.runtime.beans.actions.InstallFilesAction" actionElevationType="elevated" rollbackBarrierExitCode="0" failureStrategy="quit" errorMessage="${i18n:FileCorrupted}" />
<action id="18" beanClass="com.install4j.runtime.beans.actions.desktop.CreateProgramGroupAction" actionElevationType="elevated" rollbackBarrierExitCode="0">
<serializedBean>
Expand Down
28 changes: 27 additions & 1 deletion src/com/tree/TreeDoc.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.Path;
import java.nio.file.Paths;

import javax.swing.BorderFactory;
import javax.swing.JButton;
Expand Down Expand Up @@ -48,7 +51,7 @@ public class TreeDoc extends JFrame
private Font boldFont = new Font("Courier New", Font.BOLD, 12);
private JCheckBox includeFiles = new JCheckBox("Include Files");
private File rootFolder;
private String version = "1.10";
private String version = "1.11";
private JTextField textFilter;
private JTextArea textExcludeFolders = new JTextArea();
private JTextArea textExcludeFiles = new JTextArea();
Expand Down Expand Up @@ -281,7 +284,30 @@ private void loadConfig()
if (result)
{
rootFolder = xmlMessage.findXPath("//TreeDoc/rootFolder").trim();

Path temp = Paths.get(rootFolder);
boolean valid = Files.exists(temp);

if (valid)
{
valid = org.apache.commons.io.FileUtils.isDirectory(new File(rootFolder), LinkOption.NOFOLLOW_LINKS);
}

if (valid == false)
{
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int option = fileChooser.showOpenDialog(TreeDoc.this);

if (option == JFileChooser.APPROVE_OPTION)
{
rootFolder = fileChooser.getSelectedFile().getAbsolutePath();
}
else
{
System.exit(0);
}
}

includeFilesStr = xmlMessage.findXPath("//TreeDoc/includeFiles").trim().toUpperCase();

Expand Down

0 comments on commit e9e2342

Please sign in to comment.