Skip to content

Commit 016fba1

Browse files
committed
avoid adding duplicate files when using okapi
1 parent 490133e commit 016fba1

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

BasicCAT/BasicCAT.b4j

+20-14
Original file line numberDiff line numberDiff line change
@@ -1105,20 +1105,22 @@ Sub addFiles(path As String,files As List,prefix As String,okapiExtractedFiles A
11051105
If isFiletypeSupported(filename) Then
11061106
files.Add(prefix&filename)
11071107
Else
1108-
prefix=prefix.Replace("/",GetSystemProperty("file.separator","/"))
1109-
Dim targetFilename As String
1110-
targetFilename=File.Combine(File.Combine(File.Combine(currentProject.path,"source"),prefix),filename)
1111-
FileUtils.createNonExistingDir(File.Combine(File.Combine(path,"source"),targetFilename))
1112-
Dim outputDir As String
1113-
outputDir=File.GetFileParent(targetFilename)
1114-
Dim sl,tl As String
1115-
sl=currentProject.projectFile.Get("source")
1116-
tl=currentProject.projectFile.Get("target")
1117-
wait for (tikal.extract(sl,tl,File.Combine(path,filename),outputDir)) complete (success As Boolean)
1118-
If success=True Then
1119-
files.Add(prefix&filename)
1120-
okapiExtractedFiles.Add(prefix&filename)
1121-
End If
1108+
If currentProject.files.IndexOf(prefix&filename&".xlf")=-1 Then
1109+
prefix=prefix.Replace("/",GetSystemProperty("file.separator","/"))
1110+
Dim targetFilename As String
1111+
targetFilename=File.Combine(File.Combine(File.Combine(currentProject.path,"source"),prefix),filename)
1112+
FileUtils.createNonExistingDir(File.Combine(File.Combine(path,"source"),targetFilename))
1113+
Dim outputDir As String
1114+
outputDir=File.GetFileParent(targetFilename)
1115+
Dim sl,tl As String
1116+
sl=currentProject.projectFile.Get("source")
1117+
tl=currentProject.projectFile.Get("target")
1118+
wait for (tikal.extract(sl,tl,File.Combine(path,filename),outputDir)) complete (success As Boolean)
1119+
If success=True Then
1120+
files.Add(prefix&filename)
1121+
okapiExtractedFiles.Add(prefix&filename)
1122+
End If
1123+
End If
11221124
End If
11231125
End If
11241126
Next
@@ -1210,6 +1212,10 @@ Sub addFile(path As String)
12101212
Return
12111213
End If
12121214
If isFiletypeSupported(File.GetName(path))=False Then
1215+
If currentProject.files.IndexOf(File.GetName(path)&".xlf")<>-1 Then
1216+
fx.Msgbox(MainForm,"A file with the same name already exists.","")
1217+
Return
1218+
End If
12131219
Dim sl,tl As String
12141220
sl=currentProject.projectFile.Get("source")
12151221
tl=currentProject.projectFile.Get("target")

0 commit comments

Comments
 (0)