Skip to content

Commit 24240f0

Browse files
committed
added behavior for when value specified in sourceRootFolder is invalid
1 parent 022219e commit 24240f0

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/com/qualisystems/pythonDriverPlugin/QualiPublishDriverAction.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,20 @@ public void run(@NotNull ProgressIndicator progressIndicator) {
111111
});
112112
}
113113

114-
private File zipProjectFolder(String directory, DriverPublisherSettings settings) throws IOException {
114+
private File zipProjectFolder(String directory, DriverPublisherSettings settings) throws Exception {
115115

116116
Map<String, ByteBuffer> extras = new HashMap<>();
117117

118+
if (settings.sourceRootFolder != null && !settings.sourceRootFolder.isEmpty()) {
119+
120+
Path sourceFolder = Paths.get(directory, settings.sourceRootFolder);
121+
122+
if (!Files.exists(sourceFolder))
123+
throw new Exception(String.format("Couldn't find specified source folder \"%s\" as in \"%s\"", settings.sourceRootFolder, sourceFolder.toString()));
124+
125+
directory = sourceFolder.toString();
126+
}
127+
118128
if (settings.runFromLocalProject) {
119129

120130
String debugSettingsFileContent = String.format(DebugSettingsFormatString, directory, Boolean.toString(settings.waitForDebugger));
@@ -126,9 +136,6 @@ private File zipProjectFolder(String directory, DriverPublisherSettings settings
126136

127137
Path deploymentFilePath = Paths.get(directory, "deployment", settings.driverUniqueName + ".zip");
128138

129-
if (settings.sourceRootFolder != null && !settings.sourceRootFolder.isEmpty())
130-
directory = Paths.get(directory, settings.sourceRootFolder).toString();
131-
132139
zipHelper.zipDir(directory, deploymentFilePath.toString());
133140

134141
return deploymentFilePath.toFile();

0 commit comments

Comments
 (0)