Reading Java Properties file without escaping values

前端 未结 8 1815
滥情空心
滥情空心 2020-12-06 09:54

My application needs to use a .properties file for configuration. In the properties files, users are allow to specify paths.

Problem

Propert

8条回答
  •  日久生厌
    2020-12-06 10:13

    It's not an exact answer to your question, but a different solution that may be appropriate to your needs. In Java, you can use / as a path separator and it'll work on both Windows, Linux, and OSX. This is specially useful for relative paths.

    In your example, you could use:

    dir = c:/mydir
    

提交回复
热议问题