diff --git a/main.lua b/main.lua index 96287af..2b3ce8b 100644 --- a/main.lua +++ b/main.lua @@ -1,14 +1,14 @@ --- VARIABLES -pathWget="/usr/bin/wget" -pathDosbox="/usr/bin/dosbox" +local http = require("socket.http") +-- VARIABLES +sysUser = os.getenv( "HOME" ) +pathDosbox = "/usr/bin/dosbox" +pathFDD = sysUser.."/.fdd" +urlGameList="http://fanta.56k.es/fdd/fdd_server/archive.lst" screenSizeW = love.graphics.getWidth() screenSizeH = love.graphics.getHeight() - -love.window.setTitle( "FDD" ) - +love.window.setTitle( "FDD GUI" ) font = love.graphics.newFont("res/fonts/old_computer_st.ttf", 12) - monitor = {} monitor.img = love.graphics.newImage("res/imgs/disquete.png") monitor.width = 200 @@ -25,7 +25,6 @@ end function check_dependencies() file_check(pathDosbox) - file_check(pathWget) end function draw_floppyDiskName(floppydisk_name) @@ -34,12 +33,20 @@ function draw_floppyDiskName(floppydisk_name) love.graphics.printf(floppydisk_name,(screenSizeW/2)-50,(screenSizeH/2)-3,400,left) end +function download_gameList(url_gameList) + os.execute("mkdir -p "..pathFDD) + local body, code = http.request(url_gameList) + local f = assert(io.open(pathFDD.."/archive.lst", "wb")) + f:write(body) + f:close() +end + -- FUNCIONES LOVE function love.load() - --os.execute("dosbox") check_dependencies() + download_gameList(urlGameList) end function love.update()