From: | Chapman Flack <chap(at)anastigmatix(dot)net> |
---|---|
To: | Kartik Ohri <kartikohri13(at)gmail(dot)com> |
Cc: | pljava-dev(at)lists(dot)postgresql(dot)org |
Subject: | Re: PL/Java new build plugin |
Date: | 2020-07-07 22:42:45 |
Message-ID: | 5F04FA65.5000600@anastigmatix.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pljava-dev |
On 07/07/20 09:58, Kartik Ohri wrote:
> pgsql.properties has paths of the type C\:/PROGRA~1/POSTGR~1/12/bin while
> the our plugin has paths of type C:/PROGRA~1/POSTGR~1/12/bin. I can
> probably fix this by detecting the OS and doing a string substitution
I'm not sure that's really a Windows-specific behavior, just an
overcautious \ added before the : when the property is written to the file.
If you were using java.util.Properties and the store() method to write
the file, you also would have the \ there:
jshell> var p = new Properties()
jshell> p.put("mypath", "C:/PROGRA~1/POSTGR~1/12/bin")
jshell> p.store(System.out, "I am a comment")
#I am a comment
#Tue Jul 07 18:32:12 EDT 2020
mypath=C\:/PROGRA~1/POSTGR~1/12/bin
The backslash isn't actually necessary before a colon as part of the value.
(If a colon were part of the /key/, the backslash would be needed.)
A Properties object can happily read in the same value with or without the
backslash there:
jshell> p.clear()
jshell> p.load(new StringReader("""
...> #Tue Jul 07 18:32:12 EDT 2020
...> mypath=C:/PROGRA~1/POSTGR~1/12/bin
...> """))
jshell> p.get("mypath")
$12 ==> "C:/PROGRA~1/POSTGR~1/12/bin"
So that backslash isn't really essential there, it is just something
Properties.store() happens to add when writing a file.
So I have to assume that whatever isn't working on Windows must have
some other cause really.
It might not be worth spending much time on backslash or no backslash
in the file, as I assume eventually you will write no file at all, and
just set the properties in Maven directly.
I added some additional code comments in github:
https://github.com/amCap1712/pljava/commit/f3dd925
Regards,
-Chap
From | Date | Subject | |
---|---|---|---|
Next Message | Chapman Flack | 2020-07-08 21:37:10 | Re: Detecting test failures reported as warnings |
Previous Message | Kartik Ohri | 2020-07-07 13:58:45 | Re: PL/Java new build plugin |