mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-01 11:55:59 +08:00
Merge remote-tracking branch 'origin/GP-4057_ghidra1_ProjectLocatorPath' into patch
This commit is contained in:
+3
-3
@@ -394,9 +394,9 @@ public class RestoreDialog extends ReusableDialogComponentProvider {
|
|||||||
jarFileChooser.setTitle("Restore a Ghidra Project - Archive");
|
jarFileChooser.setTitle("Restore a Ghidra Project - Archive");
|
||||||
String lastDirSelected = Preferences.getProperty(ArchivePlugin.LAST_ARCHIVE_DIR);
|
String lastDirSelected = Preferences.getProperty(ArchivePlugin.LAST_ARCHIVE_DIR);
|
||||||
if (lastDirSelected != null) {
|
if (lastDirSelected != null) {
|
||||||
File file = new File(lastDirSelected);
|
File dir = new File(lastDirSelected);
|
||||||
if (file.exists()) {
|
if (dir.isDirectory()) {
|
||||||
jarFileChooser.setCurrentDirectory(file);
|
jarFileChooser.setCurrentDirectory(dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
File jarFile = null;
|
File jarFile = null;
|
||||||
|
|||||||
+3
-3
@@ -261,9 +261,9 @@ public class ExportToHeaderAction extends DockingAction {
|
|||||||
|
|
||||||
String lastDirSelected = Preferences.getProperty(LAST_DATA_TYPE_EXPORT_DIRECTORY);
|
String lastDirSelected = Preferences.getProperty(LAST_DATA_TYPE_EXPORT_DIRECTORY);
|
||||||
if (lastDirSelected != null) {
|
if (lastDirSelected != null) {
|
||||||
File file = new File(lastDirSelected);
|
File dir = new File(lastDirSelected);
|
||||||
if (file.exists()) {
|
if (dir.isDirectory()) {
|
||||||
fileChooser.setCurrentDirectory(file);
|
fileChooser.setCurrentDirectory(dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -94,7 +94,10 @@ public class ExportPatternFileActionListener implements ActionListener {
|
|||||||
gFileChooser.setFileFilter(xmlFilter);
|
gFileChooser.setFileFilter(xmlFilter);
|
||||||
String baseDir = Preferences.getProperty(XML_EXPORT_DIR_PROPERTY);
|
String baseDir = Preferences.getProperty(XML_EXPORT_DIR_PROPERTY);
|
||||||
if (baseDir != null) {
|
if (baseDir != null) {
|
||||||
gFileChooser.setCurrentDirectory(new File(baseDir));
|
File dir = new File(baseDir);
|
||||||
|
if (dir.isDirectory()) {
|
||||||
|
gFileChooser.setCurrentDirectory(dir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
gFileChooser.setTitle("Select Export File");
|
gFileChooser.setTitle("Select Export File");
|
||||||
File outFile = gFileChooser.getSelectedFile();
|
File outFile = gFileChooser.getSelectedFile();
|
||||||
|
|||||||
+4
-1
@@ -233,7 +233,10 @@ public class FunctionBitPatternsMainProvider extends ComponentProviderAdapter
|
|||||||
fileChooser.setTitle("Select Directory Containing XML Files");
|
fileChooser.setTitle("Select Directory Containing XML Files");
|
||||||
String baseDir = Preferences.getProperty(PATTERN_INFO_DIR);
|
String baseDir = Preferences.getProperty(PATTERN_INFO_DIR);
|
||||||
if (baseDir != null) {
|
if (baseDir != null) {
|
||||||
fileChooser.setCurrentDirectory(new File(baseDir));
|
File dir = new File(baseDir);
|
||||||
|
if (dir.isDirectory()) {
|
||||||
|
fileChooser.setCurrentDirectory(dir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
File xmlDir = fileChooser.getSelectedFile();
|
File xmlDir = fileChooser.getSelectedFile();
|
||||||
fileChooser.dispose();
|
fileChooser.dispose();
|
||||||
|
|||||||
+4
-1
@@ -64,7 +64,10 @@ public class ImportPatternFileActionListener implements ActionListener {
|
|||||||
fileChooser.setTitle("Select Pattern File");
|
fileChooser.setTitle("Select Pattern File");
|
||||||
String baseDir = Preferences.getProperty(XML_IMPORT_DIR_PROPERTY);
|
String baseDir = Preferences.getProperty(XML_IMPORT_DIR_PROPERTY);
|
||||||
if (baseDir != null) {
|
if (baseDir != null) {
|
||||||
fileChooser.setCurrentDirectory(new File(baseDir));
|
File dir = new File(baseDir);
|
||||||
|
if (dir.isDirectory()) {
|
||||||
|
fileChooser.setCurrentDirectory(dir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ExtensionFileFilter xmlFilter = new ExtensionFileFilter("xml", "XML Files");
|
ExtensionFileFilter xmlFilter = new ExtensionFileFilter("xml", "XML Files");
|
||||||
fileChooser.setFileFilter(xmlFilter);
|
fileChooser.setFileFilter(xmlFilter);
|
||||||
|
|||||||
@@ -932,9 +932,11 @@ public class KeyBindingUtils {
|
|||||||
private static File getStartingDir() {
|
private static File getStartingDir() {
|
||||||
String lastDirectoryPath = Preferences.getProperty(LAST_KEY_BINDING_EXPORT_DIRECTORY);
|
String lastDirectoryPath = Preferences.getProperty(LAST_KEY_BINDING_EXPORT_DIRECTORY);
|
||||||
if (lastDirectoryPath != null) {
|
if (lastDirectoryPath != null) {
|
||||||
return new File(lastDirectoryPath);
|
File dir = new File(lastDirectoryPath);
|
||||||
|
if (dir.isDirectory()) {
|
||||||
|
return dir;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new File(System.getProperty("user.home"));
|
return new File(System.getProperty("user.home"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -310,9 +310,12 @@ public class PathManager {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
String dir = Preferences.getProperty(preferenceForLastSelectedDir);
|
String dirPath = Preferences.getProperty(preferenceForLastSelectedDir);
|
||||||
if (dir != null) {
|
if (dirPath != null) {
|
||||||
fileChooser.setCurrentDirectory(new File(dir));
|
File dir = new File(dirPath);
|
||||||
|
if (dir.isDirectory()) {
|
||||||
|
fileChooser.setCurrentDirectory(dir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<File> files = fileChooser.getSelectedFiles();
|
List<File> files = fileChooser.getSelectedFiles();
|
||||||
|
|||||||
+6
-3
@@ -312,9 +312,12 @@ public class PathnameTablePanel extends JPanel {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
String dir = Preferences.getProperty(preferenceForLastSelectedDir);
|
String dirPath = Preferences.getProperty(preferenceForLastSelectedDir);
|
||||||
if (dir != null) {
|
if (dirPath != null) {
|
||||||
fileChooser.setCurrentDirectory(new File(dir));
|
File dir = new File(dirPath);
|
||||||
|
if (dir.isDirectory()) {
|
||||||
|
fileChooser.setCurrentDirectory(dir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<File> files = fileChooser.getSelectedFiles();
|
List<File> files = fileChooser.getSelectedFiles();
|
||||||
|
|||||||
+14
-7
@@ -137,15 +137,22 @@ class SelectProjectPanel extends AbstractWizardJPanel {
|
|||||||
directoryField = new JTextField(25);
|
directoryField = new JTextField(25);
|
||||||
directoryField.setName("Project Directory");
|
directoryField.setName("Project Directory");
|
||||||
|
|
||||||
String lastDirSelected = Preferences.getProperty(Preferences.LAST_NEW_PROJECT_DIRECTORY);
|
File projectDirectory = null;
|
||||||
if (lastDirSelected != null) {
|
String projectDirPath = Preferences.getProperty(Preferences.LAST_NEW_PROJECT_DIRECTORY);
|
||||||
directoryField.setText(lastDirSelected);
|
if (projectDirPath != null) {
|
||||||
|
// if it exists, use last directory where project was created
|
||||||
|
projectDirectory = new File(projectDirPath);
|
||||||
|
if (!projectDirectory.isDirectory()) {
|
||||||
|
projectDirectory = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
if (projectDirectory == null) {
|
||||||
File projectDirectory = new File(GenericRunInfo.getProjectsDirPath());
|
// otherwise, use last project directory or default
|
||||||
directoryField.setText(projectDirectory.getAbsolutePath());
|
projectDirectory = new File(GenericRunInfo.getProjectsDirPath());
|
||||||
}
|
}
|
||||||
directoryField.setCaretPosition(directoryField.getText().length() - 1);
|
projectDirPath = projectDirectory.getAbsolutePath();
|
||||||
|
directoryField.setText(projectDirPath);
|
||||||
|
directoryField.setCaretPosition(projectDirPath.length() - 1);
|
||||||
JLabel projectNameLabel = new GDLabel("Project Name:", SwingConstants.RIGHT);
|
JLabel projectNameLabel = new GDLabel("Project Name:", SwingConstants.RIGHT);
|
||||||
projectNameField = new JTextField(25);
|
projectNameField = new JTextField(25);
|
||||||
projectNameField.setName("Project Name");
|
projectNameField.setName("Project Name");
|
||||||
|
|||||||
@@ -423,7 +423,10 @@ class ToolActionManager implements ToolChestChangeListener {
|
|||||||
|
|
||||||
String importDir = Preferences.getProperty(Preferences.LAST_TOOL_IMPORT_DIRECTORY);
|
String importDir = Preferences.getProperty(Preferences.LAST_TOOL_IMPORT_DIRECTORY);
|
||||||
if (importDir != null) {
|
if (importDir != null) {
|
||||||
fileChooser.setCurrentDirectory(new File(importDir));
|
File dir = new File(importDir);
|
||||||
|
if (dir.isDirectory()) {
|
||||||
|
fileChooser.setCurrentDirectory(dir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fileChooser.rescanCurrentDirectory();
|
fileChooser.rescanCurrentDirectory();
|
||||||
|
|||||||
@@ -125,8 +125,8 @@ public class ProjectLocator {
|
|||||||
scanIndex = 4;
|
scanIndex = 4;
|
||||||
}
|
}
|
||||||
checkInvalidChar("path", path, scanIndex);
|
checkInvalidChar("path", path, scanIndex);
|
||||||
if (!path.endsWith(File.separator)) {
|
if (!path.endsWith("/")) {
|
||||||
path += File.separator;
|
path += "/";
|
||||||
}
|
}
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -394,7 +394,10 @@ public class SaveToolConfigDialog extends DialogComponentProvider implements Lis
|
|||||||
new ExtensionFileFilter(new String[] { "gif", "jpg", "bmp", "png" }, "Image Files"));
|
new ExtensionFileFilter(new String[] { "gif", "jpg", "bmp", "png" }, "Image Files"));
|
||||||
String iconDir = Preferences.getProperty(LAST_ICON_DIRECTORY);
|
String iconDir = Preferences.getProperty(LAST_ICON_DIRECTORY);
|
||||||
if (iconDir != null) {
|
if (iconDir != null) {
|
||||||
chooser.setCurrentDirectory(new File(iconDir));
|
File dir = new File(iconDir);
|
||||||
|
if (dir.isDirectory()) {
|
||||||
|
chooser.setCurrentDirectory(dir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
File file = chooser.getSelectedFile();
|
File file = chooser.getSelectedFile();
|
||||||
chooser.dispose();
|
chooser.dispose();
|
||||||
|
|||||||
+4
-1
@@ -145,7 +145,10 @@ class ToolServicesImpl implements ToolServices {
|
|||||||
|
|
||||||
String exportDir = Preferences.getProperty(Preferences.LAST_TOOL_EXPORT_DIRECTORY);
|
String exportDir = Preferences.getProperty(Preferences.LAST_TOOL_EXPORT_DIRECTORY);
|
||||||
if (exportDir != null) {
|
if (exportDir != null) {
|
||||||
newFileChooser.setCurrentDirectory(new File(exportDir));
|
File dir = new File(exportDir);
|
||||||
|
if (dir.isDirectory()) {
|
||||||
|
newFileChooser.setCurrentDirectory(dir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
newFileChooser.setTitle("Export Tool");
|
newFileChooser.setTitle("Export Tool");
|
||||||
|
|||||||
+4
-1
@@ -401,7 +401,10 @@ public class SpecExtensionPanel extends JPanel {
|
|||||||
private static File getStartingDir() {
|
private static File getStartingDir() {
|
||||||
String lastDirectoryPath = Preferences.getProperty(LAST_EXPORT_DIRECTORY);
|
String lastDirectoryPath = Preferences.getProperty(LAST_EXPORT_DIRECTORY);
|
||||||
if (lastDirectoryPath != null) {
|
if (lastDirectoryPath != null) {
|
||||||
return new File(lastDirectoryPath);
|
File dir = new File(lastDirectoryPath);
|
||||||
|
if (dir.isDirectory()) {
|
||||||
|
return dir;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new File(System.getProperty("user.home"));
|
return new File(System.getProperty("user.home"));
|
||||||
|
|||||||
Reference in New Issue
Block a user