Skip to content

Commit 7fe912f

Browse files
committed
Build mechanism to exclude files from build
1 parent 7cc0e68 commit 7fe912f

File tree

1 file changed

+28
-11
lines changed

1 file changed

+28
-11
lines changed

VBScript/Build.vbs

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Option Explicit
22

33
'region License ####################################################
4-
' Copyright 2021 Frank Lesniak
4+
' Copyright 2023 Frank Lesniak
55
'
66
' Permission is hereby granted, free of charge, to any person obtaining a copy of this
77
' software and associated documentation files (the "Software"), to deal in the Software
@@ -356,6 +356,10 @@ Dim strOutput
356356
Dim objTextStreamFile
357357
Dim strTextFile
358358
Dim objADODBRecordSet
359+
Dim strFolderName
360+
Dim boolIgnoreThisFile
361+
Dim strFileName
362+
Dim strFileToIgnore
359363

360364
Const ForReading = 1
361365
Const ForWriting = 2
@@ -390,22 +394,35 @@ Else
390394
For Each strSubfolderName in arrSubfolderNames
391395
If objFileSystemObject.FolderExists(strScriptDir & strSubfolderName & "\") Then
392396
Set objFolder = objFileSystemObject.GetFolder(strScriptDir & strSubfolderName & "\")
397+
strFolderName = objFolder.Name
393398
Set objADODBRecordSet = CreateObject("ADODB.RecordSet")
394399
objADODBRecordSet.Fields.Append "FilePath", adVarChar, 300
395400
objADODBRecordSet.CursorType = adOpenStatic
396401
objADODBRecordSet.Open
397402
Set arrFiles = objFolder.Files
398403
For Each objFile in arrFiles
399-
On Error Resume Next
400-
objADODBRecordSet.AddNew "FilePath", objFile.Path
401-
'objADODBRecordSet.Fields(0) = objFile.Path
402-
objADODBRecordSet.Update
403-
If Err Then
404-
On Error Goto 0
405-
Err.Clear
406-
WScript.Echo("An error occurred processing the file: " & objFile.Path)
407-
Else
408-
On Error Goto 0
404+
boolIgnoreThisFile = False
405+
406+
strFileName = objFile.Name
407+
For Each strFileToIgnore in arrFilesToIgnore
408+
If strFileToIgnore = (strFolderName & "\" & strFileName) Then
409+
boolIgnoreThisFile = True
410+
Exit For
411+
End If
412+
Next
413+
414+
If boolIgnoreThisFile = False Then
415+
On Error Resume Next
416+
objADODBRecordSet.AddNew "FilePath", objFile.Path
417+
'objADODBRecordSet.Fields(0) = objFile.Path
418+
objADODBRecordSet.Update
419+
If Err Then
420+
On Error Goto 0
421+
Err.Clear
422+
WScript.Echo("An error occurred processing the file: " & objFile.Path)
423+
Else
424+
On Error Goto 0
425+
End If
409426
End If
410427
Next
411428
objADODBRecordSet.Sort = "FilePath"

0 commit comments

Comments
 (0)