mirror of
https://github.com/alibaba/DataX.git
synced 2025-05-02 07:10:23 +08:00
hdfswriter插件buildTmpFilePath方法适配window系统目录拼接,避免本地调试写入目录被删除
This commit is contained in:
parent
3ea5ec74f7
commit
a295663729
@ -309,7 +309,9 @@ public class HdfsWriter extends Writer {
|
|||||||
}else if("/".equals(userPath)){
|
}else if("/".equals(userPath)){
|
||||||
tmpFilePath = String.format("%s__%s%s", userPath, tmpSuffix, IOUtils.DIR_SEPARATOR);
|
tmpFilePath = String.format("%s__%s%s", userPath, tmpSuffix, IOUtils.DIR_SEPARATOR);
|
||||||
}else{
|
}else{
|
||||||
tmpFilePath = String.format("%s__%s%s", userPath.substring(0,userPath.length()-1), tmpSuffix, IOUtils.DIR_SEPARATOR);
|
// tmpFilePath = String.format("%s__%s%s", userPath.substring(0,userPath.length()-1), tmpSuffix, IOUtils.DIR_SEPARATOR);
|
||||||
|
// 适配window系统目录拼接
|
||||||
|
tmpFilePath = String.format("%s__%s%s", userPath, tmpSuffix, IOUtils.DIR_SEPARATOR_UNIX);
|
||||||
}
|
}
|
||||||
while(hdfsHelper.isPathexists(tmpFilePath)){
|
while(hdfsHelper.isPathexists(tmpFilePath)){
|
||||||
tmpSuffix = UUID.randomUUID().toString().replace('-', '_');
|
tmpSuffix = UUID.randomUUID().toString().replace('-', '_');
|
||||||
@ -318,7 +320,9 @@ public class HdfsWriter extends Writer {
|
|||||||
}else if("/".equals(userPath)){
|
}else if("/".equals(userPath)){
|
||||||
tmpFilePath = String.format("%s__%s%s", userPath, tmpSuffix, IOUtils.DIR_SEPARATOR);
|
tmpFilePath = String.format("%s__%s%s", userPath, tmpSuffix, IOUtils.DIR_SEPARATOR);
|
||||||
}else{
|
}else{
|
||||||
tmpFilePath = String.format("%s__%s%s", userPath.substring(0,userPath.length()-1), tmpSuffix, IOUtils.DIR_SEPARATOR);
|
// tmpFilePath = String.format("%s__%s%s", userPath.substring(0,userPath.length()-1), tmpSuffix, IOUtils.DIR_SEPARATOR);
|
||||||
|
// 适配window系统目录拼接
|
||||||
|
tmpFilePath = String.format("%s__%s%s", userPath, tmpSuffix, IOUtils.DIR_SEPARATOR_UNIX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return tmpFilePath;
|
return tmpFilePath;
|
||||||
|
Loading…
Reference in New Issue
Block a user