[API]
GetVersion

[INCLUDE]
AppBase
GetSpecialFolderPath
CreateDirectoryEx

[CODE]
Public Function ProfileDirectoryBase_Extension(ByVal ConfigExtension As String, ByVal AppDirSubPath As String, ByVal AppDirSubPathShort As String, ByVal ConfigFilenamePrefix As String, ByVal ConfigFilenamePrefixShort As String) As String
  Dim xLong1 As Long
  Dim xChar1 As String

  ProfileDirectoryBase_Extension = AppBase(ConfigExtension)
  'GoTo UseAppData
  xLong1 = GetVersion
  If (GetVersion And &H80000000) = 0& And (xLong1 And &HFF&) > 5& Then
'UseAppData:
    xChar1 = Trim(GetSpecialFolderPath(26&, True))
    If Not Len(xChar1) = 0& Then
      If CreateDirectoryEx(xChar1 & AppDirSubPath) Then
        If Not Len(ConfigFilenamePrefix) = 0& Then ConfigFilenamePrefix = ConfigFilenamePrefix + "."
        ProfileDirectoryBase_Extension = xChar1 & AppDirSubPath + "\" + ConfigFilenamePrefix + ConfigExtension
        ElseIf CreateDirectoryEx(xChar1 & AppDirSubPathShort) Then
        If Not Len(ConfigFilenamePrefixShort) = 0& Then ConfigFilenamePrefixShort = ConfigFilenamePrefixShort + "."
        ProfileDirectoryBase_Extension = xChar1 & AppDirSubPathShort + "\" + ConfigFilenamePrefixShort + ConfigExtension
        End If
      End If
    End If
  End Function
