Skip to content
Snippets Groups Projects
Commit c6c0a35c authored by BIGARET Sebastien's avatar BIGARET Sebastien
Browse files

Merge branch 'master' into Adding_outputs_to_Result

parents 85632e88 773f32c4
No related branches found
No related tags found
No related merge requests found
......@@ -210,68 +210,6 @@ public class Facade_xml
return doc;
}
/**
* Construit un Document JDOM vide.
* @param rootName
* name for the root element
* @return <TT>Document</TT> cree
*/
public static Document createEmptyDocument(String rootName)
{
return createEmptyDocument(new Element(rootName));
}
/**
* Construit un Document JDOM vide.
* @param root
* Element racine du <TT>Document</TT>
* @return Document <TT>Document</TT> cree
*/
public static Document createEmptyDocument(Element root)
{
return new Document(root);
}
/**
* Cree un repertoire indique par 'unRepertoire'.
* @param unRepertoire
* indique le chemin du repertoire a creer
* @return true si succes, false sinon
*/
public static boolean write(String unRepertoire)
{
File unFichier = new File(unRepertoire);
return write(unFichier);
}
/**
* Cree un repertoire indique par 'unRepertoire'.
* @param directory
* indique le repertoire a creer
* @return true si succes, false sinon
*/
public static boolean write(File directory)
{
// TODO check this method (and probably the others)
if (directory.exists())
{
Log.log.finest("File already exists: " + directory);
return false;
}
if (directory.getParentFile() != null)
{
if (!directory.getParentFile().exists())
{
Log.log.finest("Parent directory does not exist: " + directory.getParentFile() + "--EXITING");
return false;
}
}
return directory.mkdir();
}
/**
* Enregistre le contenu du document 'unDocument' dans le fichier indique par 'unChemin'.
* @param document
......@@ -325,7 +263,11 @@ public class Facade_xml
{
Format fmt = Format.getPrettyFormat();
fmt.setIndent(" ");
fmt.setTextMode(Format.TextMode.NORMALIZE);
//Normalization should not be used, or we'll corrupt some of the content we save in XML,
// such as: stdout/stderr in Result, or data for parameters whose type is 'TEXT'.
// In short, there are various situations where we must not change the content: multiple
// whitespaces and newlines in particular.
//fmt.setTextMode(Format.TextMode.NORMALIZE);
XMLOutputter xmlOut = new XMLOutputter(fmt);
xmlOut.output(document, writer);
writer.close();
......
......@@ -146,14 +146,26 @@ public class PraxisPreferences
protected static void initCommon()
{
File workspaceDirectory = new File(Configuration.get("workspace_directory"));
String workspace;
searchWorkspaceLocation:
{
workspace = System.getProperty("praxis.workspace");
if (workspace!=null && !"".equals(workspace))
break searchWorkspaceLocation;
workspace = PraxisPreferences.get("client", "last_workspace");
if (workspace!=null && !"".equals(workspace))
break searchWorkspaceLocation;
workspace = Configuration.get("workspace_directory");
}
File workspaceDirectory = new File(workspace);
if (!workspaceDirectory.isAbsolute())
{
// relative to the HOME directory
String myDocumentsDirName = Environment.getUserHome();
workspaceDirectory = new java.io.File(myDocumentsDirName, workspaceDirectory.getPath());
}
// use put, not putDefault: "prefix" s completely driven by configuration key workspace_directory
// use put(), not putDefault(): "prefix" points to the current workspace, always.
PraxisPreferences.put(rootNode, "prefix", workspaceDirectory.getAbsolutePath());
// Create directory if necessary
if(!workspaceDirectory.exists())
......
......@@ -177,10 +177,12 @@ public class Parameter implements Cloneable, PropertyChangeListener
throw new IllegalArgumentException("ParameterDescription cant be a COMMAND");
case FLOAT:
case INT:
case STRING:
case BOOLEAN:
data = description.getVdef().equals("")?"0":description.getVdef();
break;
case STRING:
data = description.getVdef();
break;
case ENUM:
item = description.defaultItem();
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment