Java: Looking for hack to deal with Windows file paths in Linux
Posted
by Chase Seibert
on Stack Overflow
See other posts from Stack Overflow
or by Chase Seibert
Published on 2010-03-19T18:33:57Z
Indexed on
2010/03/19
20:41 UTC
Read the original article
Hit count: 177
java
|coldfusion
Say you have a large legacy ColdFusion on top of Java on Windows application. File access is done both via java.io.File and by CFFILE (which in turn also uses java.io.File), but not centralised in any way into a single file access library. Further, say you have file paths both hard-coded in the code, and also in a database.
In other words, assume the file paths themselves cannot change. They could be either local or remote Windows file paths:
- c:\temp\file.txt
- \\server\share\file.txt
Is there a way to run this application on Linux with minimal code changes? I'm looking for creative solutions that do not involve touching the legacy code.
Some ideas:
- Run it on WINE. This actually works, because WINE will translate the local paths, and has a samba client for the remote paths.
- Is there a way to override java.io.File to perform the file path translation with custom code? In this case, I would translate the remote paths to a mount point.
© Stack Overflow or respective owner