JBOAPPLS.psm1

<#
  File: JBOAPPLS.psm1
  Author: Casper Stekelenburg
  Copyright: © 2019 Casper Stekelenburg. All rights reserved.
  Notes: The software is provided "as is", without warranty of any kind, express or implied, including
                but not limited to the warranties of merchantability, fitness for a particular purpose and
                noninfringement. In no event shall the authors or copyright holders be liable for any claim,
                damages or other liability, whether in an action of contract, tort or otherwise, arising from,
                out of or in connection with the software or the use or other dealings in the software.
#>

#Set-StrictMode -Version 2

# Functions in this module:
#Get public and private function definition files.
$Public = @( Get-ChildItem -Path $PSScriptRoot\Public\*.ps1 -ErrorAction SilentlyContinue )
$Private = @( Get-ChildItem -Path $PSScriptRoot\Private\*.ps1 -ErrorAction SilentlyContinue )

#Dot source the files
Foreach ($import in @($Public + $Private)) {
    Try {
        . $import.fullname
    } Catch {
        Write-Error -Message "Failed to import function $($import.fullname): $_"
    }
}

<#
    Here I might...
        Read in or create an initial config file and variable
        Export Public functions ($Public.BaseName) for WIP modules
        Set variables visible to the module and its functions only
#>


#region Module Variables
$testpath = Test-Path "C:\Program Files\Microsoft Office\Office15\STARTUP"
If ($testpath -eq "True") {
    $Script:OfficePath = "C:\Program Files\Microsoft Office\Office15"
} Else {
    $Script:OfficePath = "C:\Program Files (x86)\Microsoft Office\Office15"
    $testpath = Test-Path "C:\Program Files (x86)\Microsoft Office\root\Office16"
    If ($testpath -eq "True") {
        $Script:OfficePath = "C:\Program Files (x86)\Microsoft Office\root\Office16"
    }
}
#endregion Module Variables

Export-ModuleMember -Function $Public.Basename