[API]
OSVERSIONINFO
GetVersionExA

[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 xChar1 As String
  Dim xType1 As OSVERSIONINFO

  ProfileDirectoryBase_Extension = AppBase("")
  'GoTo UseAppData
  xType1.dwOSVersionInfoSize = 148&
  If Not GetVersionExA(xType1) = 0& Then
    If xType1.dwPlatformId = &H2& And xType1.dwMajorVersion > 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
          ElseIf CreateDirectoryEx(xChar1 & AppDirSubPathShort) Then
          If Not Len(ConfigFilenamePrefixShort) = 0& Then ConfigFilenamePrefixShort = ConfigFilenamePrefixShort + "."
          ProfileDirectoryBase_Extension = xChar1 & AppDirSubPathShort + "\" + ConfigFilenamePrefixShort
          End If
        End If
      End If
    End If
  End Function
