@@ -338,12 +338,14 @@ Public Sub ImportRepositoryFiles(ByRef RepositoryPathArray() As String, _
338338 Dim i As Long
339339 Dim PathString As String
340340 Dim TempFile As Object
341+ Dim DownloadBase As String
341342
342343 ArraySize = UBound(RepositoryPathArray)
343344 For i = LBound(RepositoryPathArray) To ArraySize - 1
344- PathString = GetRepositoryFullPath(RepositoryPathArray(i))
345+ DownloadBase = vbNullString
346+ PathString = GetRepositoryFullPath(RepositoryPathArray(i), DownloadBase)
345347 Set TempFile = fso.GetFile(PathString)
346- AddMissingFile TempFile, ImportMode
348+ AddMissingFile TempFile, ImportMode, DownloadBase
347349 Next
348350 Set TempFile = Nothing
349351
@@ -357,6 +359,7 @@ Private Sub ImportFilesFromImportCollection( _
357359
358360 Dim TempFile As Object
359361 Dim FileImportMode As CodeLibImportMode
362+ Dim DownloadBase As String
360363 Dim i As Long
361364 Dim MaxCnt As Long
362365
@@ -373,28 +376,29 @@ Private Sub ImportFilesFromImportCollection( _
373376 DoCmd.RunCommand acCmdCompileAndSaveAllModules
374377 End If
375378
376- MaxCnt = m_ImportFileCollection.Count
379+ MaxCnt = m_ImportFileCollection.Count
377380
378- '/*
379- ' * TODO: Determination of the number of all files (incl. dependencies) before the import
380- ' * TODO: Conversion AccessProgressBar to single pass (Init only once)
381- ' */
381+ '/*
382+ ' * TODO: Determination of the number of all files (incl. dependencies) before the import
383+ ' * TODO: Conversion AccessProgressBar to single pass (Init only once)
384+ ' */
382385
383- i = 1
384- Do While i <= MaxCnt
385- ColItem = m_ImportFileCollection(i)
386- Set TempFile = ColItem(0 )
387- FileImportMode = ColItem(1 )
386+ i = 1
387+ Do While i <= MaxCnt
388+ ColItem = m_ImportFileCollection(i)
389+ Set TempFile = ColItem(0 )
390+ FileImportMode = ColItem(1 )
391+ DownloadBase = ColItem(2 )
388392
389- AccessProgressBar.Init "Importiere " & TempFile & "..." , 2 , 1
390- AccessProgressBar.PerformStep
393+ AccessProgressBar.Init "Importiere " & TempFile & "..." , 2 , 1
394+ AccessProgressBar.PerformStep
391395
392- ImportFile TempFile, FileImportMode, ImportTestFiles
396+ ImportFile TempFile, FileImportMode, ImportTestFiles, DownloadBase
393397
394- AccessProgressBar.PerformStep
395- MaxCnt = m_ImportFileCollection.Count
396- i = i + 1
397- Loop
398+ AccessProgressBar.PerformStep
399+ MaxCnt = m_ImportFileCollection.Count
400+ i = i + 1
401+ Loop
398402
399403
400404
@@ -633,7 +637,7 @@ Private Property Let PrivateRepositoryRootDirectory(ByVal PrivatePath As String)
633637
634638End Property
635639
636- Public Function GetRepositoryFullPath (ByVal ReleativPath As String ) As String
640+ Public Function GetRepositoryFullPath (ByVal ReleativPath As String , Optional ByRef DownloadBase As String ) As String
637641
638642 Dim RepPath As String
639643 Dim FullPath As String
@@ -655,7 +659,20 @@ Public Function GetRepositoryFullPath(ByVal ReleativPath As String) As String
655659 ElseIf Left(ReleativPath, Len(REPOSTITORY_ROOT_CODE_GITHUBROOT)) = REPOSTITORY_ROOT_CODE_GITHUBROOT Then
656660 ' %GITHUB%\owner\repo@branch\Path
657661 ReleativPath = Replace(ReleativPath, "\" , "/" )
658- If Not DownLoadFromGitHub(ReleativPath, RepPath) Then
662+ If Not DownLoadFromGitHub(ReleativPath, RepPath, DownloadBase) Then
663+ Err.Raise vbObjectError, "getRepositoryFullPath" , "Download aus GitHub ist fehlgeschlagen"
664+ Exit Function
665+ End If
666+
667+ If Len(RepPath) = 0 Then
668+ Err.Raise vbObjectError, "getRepositoryFullPath" , "Wert für lokales GitHub-Temp-Verzeichnis fehlt."
669+ Exit Function
670+ End If
671+
672+ ElseIf Left(DownloadBase, Len(REPOSTITORY_ROOT_CODE_GITHUBROOT)) = REPOSTITORY_ROOT_CODE_GITHUBROOT Then
673+ ' %GITHUB%\owner\repo@branch\Path
674+ ReleativPath = Replace(ReleativPath, "\" , "/" )
675+ If Not DownLoadFromGitHub(ReleativPath, RepPath, DownloadBase) Then
659676 Err.Raise vbObjectError, "getRepositoryFullPath" , "Download aus GitHub ist fehlgeschlagen"
660677 Exit Function
661678 End If
@@ -694,7 +711,7 @@ Public Function GetRepositoryFullPath(ByVal ReleativPath As String) As String
694711
695712End Function
696713
697- Private Function DownLoadFromGitHub (ByRef ReleativPath As String , ByRef RepPath As String ) As Boolean
714+ Private Function DownLoadFromGitHub (ByRef ReleativPath As String , ByRef RepPath As String , ByRef DownloadBase As String ) As Boolean
698715' %GITHUB%/owner/repo@branch/Path
699716
700717 Dim FullFilePath As String
@@ -704,12 +721,17 @@ Private Function DownLoadFromGitHub(ByRef ReleativPath As String, ByRef RepPath
704721 Dim GitHubUrlData() As String
705722 Dim RelativeFileUrl As String
706723
707- '%GITHUB%/owner/repo@branch/Path
708- GitHubPath = Mid(Replace(ReleativPath, "\" , "/" ), Len(REPOSTITORY_ROOT_CODE_GITHUBROOT) + 2 )
709- GitHubDataCutPos = InStr(InStr(1 , GitHubPath, "@" ) + 1 , GitHubPath, "/" )
710- GitHubUrlDataString = Left(GitHubPath, GitHubDataCutPos - 1 )
711- RelativeFileUrl = Mid(GitHubPath, GitHubDataCutPos + 1 )
712- GitHubUrlDataString = Replace(GitHubUrlDataString, "@" , "/" )
724+ If Len(DownloadBase) > 0 And InStr(1 , ReleativPath, REPOSTITORY_ROOT_CODE_GITHUBROOT) = 0 Then
725+ GitHubUrlDataString = DownloadBase
726+ Else
727+ '%GITHUB%/owner/repo@branch/Path
728+ GitHubPath = Mid(Replace(ReleativPath, "\" , "/" ), Len(REPOSTITORY_ROOT_CODE_GITHUBROOT) + 2 )
729+ GitHubDataCutPos = InStr(InStr(1 , GitHubPath, "@" ) + 1 , GitHubPath, "/" )
730+ GitHubUrlDataString = Left(GitHubPath, GitHubDataCutPos - 1 )
731+ RelativeFileUrl = Mid(GitHubPath, GitHubDataCutPos + 1 )
732+ GitHubUrlDataString = Replace(GitHubUrlDataString, "@" , "/" )
733+ DownloadBase = GitHubUrlDataString
734+ End If
713735
714736 GitHubUrlData = Split(GitHubUrlDataString, "/" )
715737 RepPath = GitHubTempRepositoryPath & "\"
@@ -737,7 +759,7 @@ Private Property Get GitHubTempRepositoryPath() As String
737759End Property
738760
739761Private Sub ImportFile (ByRef ImportFile As Object , ByRef ImportMode As CodeLibImportMode , _
740- Optional ByVal ImportTestFiles As Boolean = False )
762+ Optional ByVal ImportTestFiles As Boolean = False , Optional DownloadBase As String )
741763
742764 Dim i As Long
743765 Dim TempFile As Object
@@ -758,16 +780,16 @@ Private Sub ImportFile(ByRef ImportFile As Object, ByRef ImportMode As CodeLibIm
758780
759781 'License (LICENSE block)
760782 If Len(m_CLI.LicenseFile) > 0 Then
761- FilePath = GetRepositoryFullPath(m_CLI.LicenseFile)
783+ FilePath = GetRepositoryFullPath(m_CLI.LicenseFile, DownloadBase )
762784 Set TempFile = fso.GetFile(FilePath)
763- AddMissingFile TempFile, clim_ImportMissingItems
785+ AddMissingFile TempFile, clim_ImportMissingItems, DownloadBase
764786 End If
765787
766788 'Required modules (USE block)
767789 If ImportMode <> clim_ImportSelectedOnly Then
768790 If (0 / 1 ) + (Not Not m_CLI.Dependency) Then
769791 For i = 0 To UBound(m_CLI.Dependency)
770- FilePath = GetRepositoryFullPath(m_CLI.Dependency(i))
792+ FilePath = GetRepositoryFullPath(m_CLI.Dependency(i), DownloadBase )
771793 If fso.FileExists(FilePath) Then
772794 Set TempFile = fso.GetFile(FilePath)
773795 AddMissingFile TempFile, ImportMode
@@ -801,7 +823,7 @@ Private Sub ImportFile(ByRef ImportFile As Object, ByRef ImportMode As CodeLibIm
801823 If ImportTestFiles Then
802824 If (0 / 1 ) + (Not Not m_CLI.TestFiles) Then
803825 For i = 0 To UBound(m_CLI.TestFiles)
804- FilePath = GetRepositoryFullPath(m_CLI.TestFiles(i))
826+ FilePath = GetRepositoryFullPath(m_CLI.TestFiles(i), DownloadBase )
805827 If fso.FileExists(FilePath) Then
806828 Set TempFile = fso.GetFile(FilePath)
807829 AddMissingFile TempFile, ImportMode
@@ -844,7 +866,7 @@ Private Sub AddMissingReference(ByRef NewCodeLibRef As CodeLibInfoReference)
844866
845867End Sub
846868
847- Private Sub AddMissingFile (ByVal UsedFile As Object , ByVal ImportMode As CodeLibImportMode )
869+ Private Sub AddMissingFile (ByVal UsedFile As Object , ByVal ImportMode As CodeLibImportMode , Optional ByVal DownloadBase As String = vbNullString )
848870
849871 Dim FileColItem As Variant
850872 Dim TempFile As Object
@@ -863,7 +885,7 @@ Private Sub AddMissingFile(ByVal UsedFile As Object, ByVal ImportMode As CodeLib
863885 End If
864886 Next
865887
866- FileColItem = Array(UsedFile, ImportMode)
888+ FileColItem = Array(UsedFile, ImportMode, DownloadBase )
867889 m_ImportFileCollection.Add FileColItem, UsedFile.Path
868890
869891End Sub
0 commit comments