You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jeffrey Janner <Je...@PolyDyne.com> on 2013/08/06 17:05:44 UTC

Option to allow "\" in hardcoded file paths

Had a programmer build a filepath using "\" instead of "/" , because he's windows centric (duh).
Works great on my mostly windows deployments, but fails spectacularly on Unix/Linux boxes.
Is there a Java option that can force the Linux boxes to treat the backslash as a forward slash?
Fixing the code for future releases, but need to get something working now with existing code.

Jeffrey Janner
Sr. Network Administrator
jeffrey.janner@polydyne.com<ma...@polydyne.com>
PolyDyne Software Inc.
Main:   512.343.9100
Direct:  512.583.8930

 [cid:image002.png@01CC0FB7.4FF43CE0]

Speed, Intelligence & Savings in Sourcing


RE: Option to allow "\" in hardcoded file paths

Posted by Jeffrey Janner <Je...@PolyDyne.com>.
From: Jeffrey Janner [mailto:Jeffrey.Janner@PolyDyne.com]
Sent: Tuesday, August 06, 2013 10:06 AM
To: 'Tomcat Users List'
Subject: Option to allow "\" in hardcoded file paths

Had a programmer build a filepath using "\" instead of "/" , because he's windows centric (duh).
Works great on my mostly windows deployments, but fails spectacularly on Unix/Linux boxes.
Is there a Java option that can force the Linux boxes to treat the backslash as a forward slash?

[Jeff Janner] Obviously, the answer to my question above was "No!", though no one bothered to address it directly.

Fixing the code for future releases, but need to get something working now with existing code.

[Jeff Janner] Yes, I changed all hard-coded path separators to "/" and recompiled.  Luckily, I had the time to make the correction before it went out to the customer base.

Jeffrey Janner
Sr. Network Administrator
jeffrey.janner@polydyne.com<ma...@polydyne.com>
PolyDyne Software Inc.
Main:   512.343.9100
Direct:  512.583.8930

 [cid:image002.png@01CC0FB7.4FF43CE0]

Speed, Intelligence & Savings in Sourcing


Re: Option to allow "\" in hardcoded file paths

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Jeffrey,

On 8/6/13 11:05 AM, Jeffrey Janner wrote:
> Had a programmer build a filepath using "\" instead of "/" ,
> because he's windows centric (duh).
> 
> Works great on my mostly windows deployments, but fails
> spectacularly on Unix/Linux boxes.
> 
> Is there a Java option that can force the Linux boxes to treat the 
> backslash as a forward slash?
> 
> Fixing the code for future releases, but need to get something
> working now with existing code.

Usually, the procedure is to always use / and let the Windows JVM
"convert" the file path appropriately. The reason to favor "/" instead
of "\" is because "\" has another meaning as a general-purpose escape
character.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJSAR3PAAoJEBzwKT+lPKRYGtkP/0oKxhT+u1T0crLzsi37E+++
gIibqqIUtAcrWNU9NeAACc39dMT+avATR1P+2G5OnxG0doqrXjvVqYiX9F+hgv2g
cWXNH5GJUCRpJKH5LPWcdcxGziqselHiWy2aKnLYoEY598JtvcjRE2sBKApjPvNA
VQmcCBeBbbJlo1hgdMzOM85MZyYoPke0PVPAz53jsr06yrtPmzyyup67tAbdQaZ4
lgYlxpXn+9N6QTJLf6zQq9ByClgEBGDuiAdZIklM1dVm/LCqDzLsHLngs7XfvQxF
k/Fw8Ej5qyvNE2J8zSADmsjGazszjdJF/w167dTLPbZtpg1/HaRLLZ6ywK5i1oZP
QdmDTaLhp1BzLlx500K2uzpDJlP9/41oP19yN+/+YJP0uf/Bq6sLwnh9uCrdbKsm
pKQtVNtB0u1xXoyui0gF8VyCQnTiIVIfHFXIXFvGOm9nDqUJva2eViJimI5eKPG5
LxNFRBu7wtOFt5QpMgoFoSwEKt0E24FHNYP5qa+uW3jHVv5UW8xECpPv9uishmkO
XjQfej1SOhgzvxm8yGkTB+twt51zfx7joUHZMyZ/OowPgBe5sbqBe3q7W71MDj09
M6DiRjuPEewIs12Hh7QkKQURt9Y4Khae01+ShegTFwsi74QHbMc9Eer0KCie8+/d
q5R6LY1mGn99imKc0B/4
=YxII
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Option to allow "\" in hardcoded file paths

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Mark,

On 8/7/13 9:00 AM, Mark H. Wood wrote:
> On Tue, Aug 06, 2013 at 03:05:44PM +0000, Jeffrey Janner wrote:
>> Had a programmer build a filepath using "\" instead of "/" ,
>> because he's windows centric (duh).
> 
> Probably should be using java.io.File.separator.

It's not worth it, since / always works regardless of platform. It
also works in properties files where using File.separator is not an
option.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJSAsbBAAoJEBzwKT+lPKRY4TAP/2HQgeiOoOLXZwkWaTaYd8nl
uu5nHZslcyMAIbxa6A1wVOpf4fV9wQtfgGP3Jvtun2UZ4wq5F+TpODTcjO21/4QG
SwQ4BNCkbxRfLRfL0Vi6H8vs1RKZRlgeUHEwmfCV4FvPzXnvu93gJ228TWxl5Cg5
1FGMls7hSJ5PWWKEtMRhagcwhRxuIYiuV5Ot8YWXRktfmBdUU2XpVFaSmUmv63gD
BK/X2V9aHJtwvnML8SFYZRRbY3JTSbTwDdZ4aSAdc/2qZIKBW8HJCdDXZd4nfb84
y0CnMHo4bXhH8f+fsLgugpFQXi1Q90NQUCD6hWhXjN1RurBaTQfs5o35PeSKLaON
CCKe4XC0UoLdFhTKNHVGa2+pRytM1ZmP1Tc5huP5My707WCKW/bpfA5i/Jot4DfQ
HgD63pW5JJATReOlBND8g2ehkclvan9D0/RfEbT42t4kJavPllqdjbfJgRmL7beG
xX+0nAQhMUIvTpkjO2bVoMFWqKoupWKk/6AHlxNmQverFPW558htImFiTh+d4cGG
Me7aXHZQJD4Chm8QmQCVbeXMTUMhmbfNq7/KYlKzO7gT0t72JSscWeJQpwga8RrE
wgOL5wvCpA+MGr2cCO4uft1rM80q/VEKl1LaGXhKFdzwr90PjWO12Kt4l0l7srYW
AXrMJGI3AtmluJy2yjYB
=T5yu
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Option to allow "\" in hardcoded file paths

Posted by "Mark H. Wood" <mw...@IUPUI.Edu>.
On Tue, Aug 06, 2013 at 03:05:44PM +0000, Jeffrey Janner wrote:
> Had a programmer build a filepath using "\" instead of "/" , because he's windows centric (duh).

Probably should be using java.io.File.separator.

-- 
Mark H. Wood, Lead System Programmer   mwood@IUPUI.Edu
Machines should not be friendly.  Machines should be obedient.