Closed Doekin closed 3 days ago
Bot detected the issue body's language is not English, translate it automatically.
Title: Detect and avoid copying parent directory to subdirectory
When the file structure is as follows
.
└── ParentDir
└── SubDir
Calling tb_directory_copy("./ParentDir", "./ParentDir/SubDir",TB_FILE_COPY_NONE)
will coredump and generate the structure of ParentDir/SubDir/SubDir/SubDir/SubDir/SubDir/...
When there is a problem with the path parameters and a loop is formed, tb_directory_copy
returns false
这种你自己在外面检测下就好了,这边只提供最基础的跨平台实现,有些复杂的参数有效性检测,你外面自己也能做。。
Bot detected the issue body's language is not English, translate it automatically.
Just do the testing yourself outside. Here we only provide the most basic cross-platform implementation. You can also do some complex parameter validity testing outside. .
OK
你在什么场景下需要该功能?
当文件结构如下时
调用
tb_directory_copy("./ParentDir", "./ParentDir/SubDir",TB_FILE_COPY_NONE)
,会 coredump,并产生ParentDir/SubDir/SubDir/SubDir/SubDir/SubDir/...
的结构描述可能的解决方案
当路径参数有问题,会形成循环时,
tb_directory_copy
返回 false