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

60 lines
1.8 KiB
Plaintext
Raw Normal View History

' Gambas module file
2014-01-12 08:13:48 +08:00
' Copyright(C) 2011-2014, Michał Głowienka aka eloaders <eloaders@linux.pl>
'
' This program is free software; you can redistribute it and/or modify
2014-01-27 22:57:25 +08:00
' it under the terms of the GNU General Public License as published by
2014-01-12 08:13:48 +08:00
' 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/>.
2014-01-05 22:46:26 +08:00
Public Logs As New Logger
Public Sub _inits()
2014-01-06 06:28:44 +08:00
Dim Do_not_print As String
If Access(User.Home & "/", gb.Write) = False Then
2013-12-30 10:48:21 +08:00
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)
2014-01-05 22:46:26 +08:00
Logs("Try to remove files", Logger.Info)
Remove_Nedded_Files()
Logs("Copy nedded files", Logger.Info)
Copy_Nedded_Files()
Else
2014-01-05 22:46:26 +08:00
Logs("i-nex in home folder not exist", Logger.Error)
Create_Nedded_Folders()
2014-01-05 22:46:26 +08:00
Logs("i-nex in home folder created", Logger.Info)
Endif
2014-01-06 06:28:44 +08:00
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