英文:
File creation without creating new folder [confusion] from user-input
问题
让我们假设有一个用户想要一个名为:"test/lasdhjal.txt" 的文件,不管是什么文件。现在,如果我将其放入一个新的 File(input); 对象内部,它会认为 test/ 是一个文件夹,而实际上它是名称的一部分。我可以采取什么措施来解决这个问题?
英文:
Lets say we have a user who wants a file named:
"test/lasdhjal.txt", whatever. Now if I put this into a new File(input); object inside, it will think that test/ is a folder, whilst it's a part of the name. What can I do against that?
答案1
得分: 1
不允许在文件名中使用“/”是在内核级别强制实施的限制,这不是您可以规避的内容。
英文:
No, the limitation of not allowing a "/" in a file name is imposed at the kernel level, this is not something you can get around.
专注分享java语言的经验与见解,让所有开发者获益!
评论