Hello --
So I'm on a Linux box and my colleague is on a Windows system. We're both using a query that takes before and after versions of a file, converts each to a single string, and writes that back out as two additional files. (This exists to check if we still have all the words in the same order between before and after.)
There must be a sensible way to parameterize the file names so they can be relative to the query on both platforms/easily loaded from a file/something that isn't hand-editing a variable (external or not), but I can't think of it.
What's the sensible way to do this?
Thanks! Graydon
Hi Graydon,
If this is the contents of "count.xq"…
declare variable $file external; count($file => file:read-text() => string-to-codepoints())
…you can use the -b flag to bind a value to a variable:
basex -b file=abs-or-rel-path/to/input.txt count.xq
I’m not sure if that helps. Feel free to give us more information on your use case. A minimized test case would be very appreciated.
Best, Christian
On Mon, Jan 25, 2021 at 9:18 PM Graydon Saunders graydonish@gmail.com wrote:
Hello --
So I'm on a Linux box and my colleague is on a Windows system. We're both using a query that takes before and after versions of a file, converts each to a single string, and writes that back out as two additional files. (This exists to check if we still have all the words in the same order between before and after.)
There must be a sensible way to parameterize the file names so they can be relative to the query on both platforms/easily loaded from a file/something that isn't hand-editing a variable (external or not), but I can't think of it.
What's the sensible way to do this?
Thanks! Graydon
Hi Christian --
On Tue, Jan 26, 2021 at 02:58:45PM +0100, Christian Grün scripsit:
If this is the contents of "count.xq"…
declare variable $file external; count($file => file:read-text() => string-to-codepoints())
…you can use the -b flag to bind a value to a variable:
basex -b file=abs-or-rel-path/to/input.txt count.xq
I’m not sure if that helps. Feel free to give us more information on your use case. A minimized test case would be very appreciated.
Thank you!
That does help.
The core problem was having a bunch of file locations in variables.
These have a common base (the project directory) which is different on every developer's system.
"How do we get the query with the tests to run consistently without having to manually update those variables?" is solvable with a combination of the -b flag above and file:resolve-path(), which is the problem I was trying to solve.
Thank you! Graydon
basex-talk@mailman.uni-konstanz.de