Hi,

How could I retrieve both the source and destination when they are either side of an if statement?

Here is my code:

vb Code:
  1. Private Sub WinVersion()
  2.     Dim osinfo As OSVERSIONINFO
  3.     Dim retvalue As Integer
  4.     Dim sNextFile As String
  5.     osinfo.dwOSVersionInfoSize = 148
  6.     osinfo.szCSDVersion = Space$(128)
  7.     retvalue = GetVersionExA(osinfo)
  8.     If osinfo.dwMajorVersion = 7 Then 'Windows 7
  9.    If Not Dir$(App.path & "\xlive.dll") <> "" Then
  10.     path = "C:\Users\" & sUserName & "\AppData\Local\Rockstar Games\GTA IV\Settings\"
  11.     source = path
  12.     Else
  13.     path = "C:\Users\" & sUserName & "\Documents\Rockstar Games\GTA IV\savegames\"
  14.     destination = path
  15.     End If
  16.     ElseIf osinfo.dwMajorVersion = 6 Then 'Vista
  17.     If Not Dir$(App.path & "\xlive.dll") <> "" Then
  18.     path = "C:\Users\" & sUserName & "\AppData\Local\Rockstar Games\GTA IV\Settings\"
  19.      source = path
  20.       Else
  21.     path = "C:\Users\" & sUserName & "\Documents\Rockstar Games\GTA IV\savegames\"
  22.      destination = path
  23.     End If
  24.     ElseIf osinfo.dwMajorVersion = 5 Then 'XP
  25.     If Not Dir$(App.path & "\xlive.dll") <> "" Then
  26.     path = "C:\Documents and Settings\" & sUserName & "\Local Settings\Application Data\Rockstar Games\GTA IV\Settings\"
  27.      source = path
  28.     Else
  29.     path = "C:\Users\" & sUserName & "\Documents\Rockstar Games\GTA IV\savegames\"
  30.      destination = path
  31.     End If
  32.     'ElseIf osinfo.dwMajorVersion = 4 Then 'Win2k etc.
  33.     Else
  34.     End If
  35.     'copy
  36.     'Delete (path)
  37. End Sub

I need to set the source and destination folders depending on whether or not the "xlive.dll" is location in the folder or not. If there is a better why to copy the files please show me.

Thanks,


Nightwalker