Added a silent mode

This commit is contained in:
2020-04-10 18:16:40 +03:00
parent 0c4b848b13
commit ce167dc7b0

View File

@@ -1,6 +1,5 @@
#!/usr/local/bin/lua
fl = require('moonfltk')
lfs = require('lfs')
require('lib/getOS')
require('settings')
@@ -10,8 +9,17 @@ print('Detected OS: ' .. OS)
arg = {...}
silent_mode = arg[1] == '-s'
if silent_mode then
print("silent_mode")
else
fl = require('moonfltk')
end
function to_pc(button)
if button then
print(button:label())
end
if selected_device ~= '' then
if OS ~= 'Windows' then
os.execute('cp -rv '..selected_path..'/. '..local_dir)
@@ -20,7 +28,10 @@ function to_pc(button)
end
function to_phone(button)
if button then
print(button:label())
end
if selected_device ~= '' then
if OS ~= 'Windows' then
os.execute('cp -rv '..local_dir..'/. '..selected_path)
@@ -47,7 +58,7 @@ function refresh_devices()
phone_dir[#phone_dir + 1] = i
end
if win then
if win then -- If fltk window created
if #phone_dir == 0 then
device_choice:clear()
device_choice:deactivate()
@@ -72,6 +83,7 @@ if OS ~= 'Windows' then
mount_point = '/run/user/1000/gvfs'
end
if not silent_mode then
W, H = 320, 360
fl.visual('rgb')
@@ -85,10 +97,6 @@ bg_img = fl.png_image(my_dir..'/img/bg.png')
bg_box = fl.box(1, 1, W, H)
bg_box:image(bg_img)
if OS ~= 'Windows' then
--fl.box(0, 20, W, 30, 'Точка монтирования:')
end
fl.box(0, 70, W, 30, 'Выберите устройство:')
refresh_img = fl.png_image(my_dir..'/img/refresh.png')
refresh_btn = fl.button(10, 100, 30, 30)
@@ -110,4 +118,13 @@ win:done()
win:show(arg[0], arg)
return fl.run()
else
selected_path = mount_point..'/'..phone_dir[1]..'/Внутренняя\\ память/StardewValley'
if arg[2] == 'tophone' then
to_phone()
elseif arg[2] == 'topc' then
to_pc()
end
end