Safe cross-platform function to get normalized path

前端 未结 2 1762
逝去的感伤
逝去的感伤 2021-01-19 00:09

I\'d like to have a standard function that will convert relative paths into absolute ones, and if possible I\'d like to make it as cross-platform as possible (so I\'d like t

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-19 00:42

    I think the closest you're going to get to platform independence are the POSIX libraries. In particular you'll wanna check out unistd.h which unfortunately I don't believe has a 'normalized' path concept. If I remember correctly the standard itself doesn't even know much about directories much less relative ones.

    To get better than that I think you'll need to roll your own path goodies.

提交回复
热议问题