Skip to content

Commit 0fe4737

Browse files
authored
Merge pull request #3572 from ControlSystemStudio/edm_autocvt_outpath
EDM converter: Create output path folders
2 parents 18687b5 + 6229c41 commit 0fe4737

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

app/display/convert-edm/src/main/java/org/csstudio/display/converter/edm/ConverterPreferences.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2019-2022 Oak Ridge National Laboratory.
2+
* Copyright (c) 2019-2025 Oak Ridge National Laboratory.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -66,6 +66,7 @@ public FontMapping(final String pattern, final String font_name)
6666
logger.log(Level.WARNING, "Cannot parse font_mappings", ex);
6767
}
6868

69+
edm_paths_config = edm_paths_config.strip();
6970
if (! edm_paths_config.isEmpty())
7071
try
7172
{
@@ -76,8 +77,8 @@ public FontMapping(final String pattern, final String font_name)
7677
logger.log(Level.WARNING, "Cannot parse paths from " + edm_paths_config, ex);
7778
}
7879

79-
final String dir = prefs.get("auto_converter_dir");
80-
if (dir.isBlank())
80+
final String dir = prefs.get("auto_converter_dir").strip();
81+
if (dir.isEmpty())
8182
auto_converter_dir = null;
8283
else
8384
{

app/display/convert-edm/src/main/java/org/csstudio/display/converter/edm/EdmAutoConverter.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2019-2022 Oak Ridge National Laboratory.
2+
* Copyright (c) 2019-2025 Oak Ridge National Laboratory.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -10,6 +10,7 @@
1010
import static org.csstudio.display.converter.edm.Converter.logger;
1111

1212
import java.io.File;
13+
import java.nio.file.Files;
1314
import java.util.concurrent.ConcurrentHashMap;
1415
import java.util.concurrent.Semaphore;
1516
import java.util.logging.Level;
@@ -142,7 +143,11 @@ private DisplayModel doConvert(final String display_path) throws Exception
142143
// Convert EDM input
143144
logger.log(Level.INFO, "Converting " + input + " into " + output);
144145
locator.setPrefix(new File(display_file).getParent());
145-
new EdmConverter(input, locator).write(output);
146+
final EdmConverter converter = new EdmConverter(input, locator);
147+
148+
// Save EDM file to potentially new folder
149+
Files.createDirectories(output.getParentFile().toPath());
150+
converter.write(output);
146151

147152
// Return DisplayModel of the converted file
148153
return ModelLoader.loadModel(output.getPath());

0 commit comments

Comments
 (0)