<div dir="ltr"><div><div><div><br><br>On Tue, Apr 17, 2018 at 4:21 PM, Nikos Alexandris <<a href="mailto:nik@nikosalexandris.net">nik@nikosalexandris.net</a>> wrote:<br>><br>> * Moritz Lennert <<a href="mailto:mlennert@club.worldonline.be">mlennert@club.worldonline.be</a>> [2018-04-17 15:56:10 +0200]:<br>><br>>> On 17/04/18 15:31, Nikos Alexandris wrote:<br>>>><br>>>> Dear developers,<br>>>><br>>>> is there a way to set a string as the content of a default "answer" for<br>>>> the G_OPT_F_INPUT option? I am trying to identify potential cases in the<br>>>> grass-addons repository, but I am not sure I have seen something related.<br>>>><br>>>> The G_OPT_F_INPUT offers a field to enter a filename. The default<br>>>> "answer", for the parser, will be the name of the file.<br>>>><br>>>> In addition, a field to "enter values directly" is created. The<br>>>> description of this field is: "Enter file content directly instead of<br>>>> specifying a file. Temporary file will be automatically created."<br>>>><br>>>> Can this field be filled with a pre-defined content?<br>>>> The use case is to expose, to the user, a pre-defined set of<br>>>> reclassification rules. These will help a beginner to get started,<br>>>> understand easier and modify rules as he sees fit.<br>>><br>>><br>>> Use the 'answer' parameter:<br>>><br>>> #% answer : myfilename<br>>><br>>> Moritz<br>><br>><br>> It works: it loads the content of an external file. Are we forced to use<br>> external files in such a case? Which means an extra file has to be<br>> shipped with the source code.<br>> Can we not use an in-script hardcoded string for example?<br><br></div>Be aware that you can't use a hardcoded full path, because depending on the installation/user/os, that path may or may not exist. If you use a relative path, that path is relative to the current working directory which is of course not constant between sessions/installation/user/os. I'm afraid a default answer to G_OPT_F_INPUT will cause a lot of trouble.<br><br></div>my2c<br><br></div>Markus M<br><div><div><div>><br>> Thank you Moritz, Nikos<br>><br>> _______________________________________________<br>> grass-dev mailing list<br>> <a href="mailto:grass-dev@lists.osgeo.org">grass-dev@lists.osgeo.org</a><br>> <a href="https://lists.osgeo.org/mailman/listinfo/grass-dev">https://lists.osgeo.org/mailman/listinfo/grass-dev</a><br><br></div></div></div></div>