[jira] [Commented] (OFBIZ-10428) Don't guess the system file separator

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-10428) Don't guess the system file separator

Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-10428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16518642#comment-16518642 ]

Jacques Le Roux commented on OFBIZ-10428:
-----------------------------------------

Actually there are 2 quirks in your patches.
# In case of Windows we need to escape "\" so adding {code}"\\"{code} before fileSep is required
# In is not a replacement for contains but is based on isCase so we can't use it reliably for that purpose, see http://docs.groovy-lang.org/latest/html/groovy-jdk/java/lang/Class.html and https://stackoverflow.com/questions/2068298/how-does-the-groovy-in-operator-work
For instance
{{def isWindows = System.getProperty('os.name').toLowerCase().contains("windows")}} works but not
{code}
//String os = System.getProperty('os.name').toLowerCase()
def os = System.getProperty('os.name').toLowerCase()
//def isWindows = 'windows' in os
def isWindows = "windows" in os
{code}
using String or def, simple or double quote. Did you not confuse with Kotlin: https://medium.com/@agrawalsuneet/in-operator-in-kotlin-bbf0b6131718 ?

I fixed the #1 quirk in revision: 1833957  using contains instead of in. I must say it's late and I'm tired so I maybe missed something. In any cases I prefer to delay working on OFBIZ-10430 for tonight ;)



> Don't guess the system file separator
> -------------------------------------
>
>                 Key: OFBIZ-10428
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-10428
>             Project: OFBiz
>          Issue Type: Improvement
>            Reporter: Mathieu Lirzin
>            Assignee: Jacques Le Roux
>            Priority: Minor
>             Fix For: Upcoming Branch
>
>         Attachments: OFBIZ-10428_Don_t-guess-the-system-file-separator.patch
>
>
> The JVM already knows the file separator of the current system when running gradle so use that value instead of guessing from the operating system property.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)