I-Nex/I-Nex/i-nex/.src/MInit.module

60 lines
1.8 KiB
Plaintext

' 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 config directory in user/home folder exist", Logger.Info)
Logs("Try to remove files", Logger.Info)
Remove_Nedded_Files()
Logs("Copy nedded files", Logger.Info)
Copy_Nedded_Files()
Else
Logs("i-nex in home folder not exist", Logger.Error)
Create_Nedded_Folders()
Logs("i-nex in home folder created", Logger.Info)
Endif
Do_not_print = Null
End
Private Function Remove_Nedded_Files()
Try Kill User.Home & "/.i-nex/gputemp"
Try Kill User.Home & "/.i-nex/i-nex-lspci"
End
Private Function Copy_Nedded_Files()
Logs("Copy gputemp from Data/gputemp to " & User.Home &/ ".i-nex/gputemp", Logger.Info)
Try Copy "Data/gputemp" To User.Home &/ ".i-nex/gputemp"
Try Copy "Data/i-nex-lspci" To User.Home &/ ".i-nex/i-nex-lspci"
End
Private Function Create_Nedded_Folders()
Try Mkdir User.Home & "/.i-nex/"
End