Closed tomasherman closed 12 years ago
As stated in the wiki, Strings must be enclosed in double-quotes if they contain whitespace.
But if the value is generated by the library without quotes, it looks like a bug. I will try to fix it this week-end. Could you please show me how do you set the directories
value in your code ?
Sure, this is the code:
private class Content extends BoxPanel(Orientation.Vertical) {
val panel = this
contents += new Button("Add folder") {
listenTo(this)
reactions += {
case ButtonClicked(b) if b == this => {
val f = new FileChooser()
f.fileSelectionMode = FileChooser.SelectionMode.DirectoriesOnly
f.showDialog(panel, "Choose") match {
case FileChooser.Result.Approve => {
list.listData = list.listData :+ f.selectedFile
}
case _ =>
}
}
}
}
contents += new ScrollPane(list)
contents += new BoxPanel(Orientation.Horizontal) {
contents += new SelfButton("Save", { () =>
configActor ! UpdateConfig(cfg.set(ConfigKeys.directories, list.listData.toSet.toList))
dialog.dispose
})
contents += new SelfButton("Exit", { dialog.dispose })
}
}
I use swing ListView to display the directories and when user adds some, i simply add it to the configuration and bang it to another actor.
To persist the configuration, i use:
outputFile.outputStream(WriteTruncate:_*).write(config.format())
(i use scalax io library)
I was looking into the code base, if i understand it correctly,
def set[A]( key: String, a: A ) =
Configuration( data + ( key -> a.toString ) )
shouldn't add " " around the a if the a is a string (or file, for that matter)?
We should add quotes only when needed (when the list values contain spaces or other non alphanumeric characters).
As long as I can check, the issue is fixed on the master branch. I've added two tests to check the issue. Could you please test it ? I will try to generate and publish the artifacts tonight.
I will test it when the artifact is released, if that's ok. Also, thanks a lot for fast fix :)
On Sun, May 6, 2012 at 1:14 PM, Paradigmatic < reply@reply.github.com
wrote:
As long as I can check, the issue is fixed on the master branch. I've added two tests to check the issue. Could you please test it ? I will try to generate and publish the artifacts tonight.
Reply to this email directly or view it on GitHub: https://github.com/paradigmatic/Configrity/issues/12#issuecomment-5534867
Hey, just wanted to say that it indeed fixed my issue. Once again, thanks
Glad to help and thanks for reporting the issue.
Hey there, Configrity seems to be throwing exceptions when parsing Files that contain whitespaces in the path. Is this a bug?
example of configuration:
I should mention that the configuration file is generated by the library itself.
we have here a list of files, this error is thrown: