' Gambas module file

' Copyright(C) 2011-2014, Michał Głowienka aka eloaders <eloaders@linux.pl>
'
' This program is free software; you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation; either version 3 of the License, or
' (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
' GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program. If not, see <http://www.gnu.org/licenses/>.

Public Logs As New Logger
Public Sub _inits()
 Dim Do_not_print As String
 If Access("" & User.Home & "/", gb.Write) = False Then
  Message.Error("Cannot write files to " & User.Home & "/.i-nex")
 Endif
 If Exist("" & User.Home & "/.i-nex") Then
  
  Logs("i-nex in home folder is exist", Logger.Info)
  Logs("Try to remove files", Logger.Info)
  'Try Kill User.Home & "/.i-nex/screenfetch-dev"
  Try Kill User.Home & "/.i-nex/gputemp"
 Else
  Logs("i-nex in home folder not exist", Logger.Error)
  Try Mkdir User.Home & "/.i-nex/"
  Logs("i-nex in home folder created", Logger.Info)
 Endif
 
 Logs("Copy nedded files", Logger.Info)
 'Logs("Copy screenfetch-dev from Data/screenfetch-dev to " & User.Home &/ ".i-nex/screenfetch-dev", Logger.Info)
 ' Copy "Data/screenfetch-dev" To User.Home &/ ".i-nex/screenfetch-dev"
 Logs("Copy gputemp from Data/gputemp to " & User.Home &/ ".i-nex/gputemp", Logger.Info)
  Copy "Data/gputemp" To User.Home &/ ".i-nex/gputemp"
 'Logs("Execute copied files", Logger.Info)
 'Logs("Execute screenfetch-dev", Logger.Info)
 'Exec ["/bin/bash", "" & User.Home & "/.i-nex/screenfetch-dev"] Wait To Do_not_print
 Do_not_print = Null
 
 ' If Settings["FirstRun/Value"] = "True" Then
 '    If Settings["FirstRun/AppVer"] < Application.Version Then
 ' 
 '       Desktop.Open("http://i-nex.linux.pl/" & Application.Version & "")
 '       Settings["FirstRun/AppVer"] = Application.Version
 ' 
 '    Else
 ' 
 '       Logs("This is not first run of I-Nex", Logger.Info)
 ' 
 '    Endif
 ' 
 ' 
 ' Else
 ' 
 '    Desktop.Open("http://i-nex.linux.pl")
 '    Settings["FirstRun/Value"] = "True"
 '    Settings["FirstRun/AppVer"] = Application.Version
 ' 
 ' Endif
 
End
