-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLrInitPlugin.lua
51 lines (42 loc) · 1.29 KB
/
LrInitPlugin.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
-- Init script.
-- Currently, just update the plugin if auto-update is enabled in the preferences.
local prefs = import 'LrPrefs'.prefsForPlugin()
local LrFileUtils = import 'LrFileUtils'
local LrPathUtils = import 'LrPathUtils'
local logger = import 'LrLogger'( 'Stash' )
require 'Utils'
local logPath = LrPathUtils.child(LrPathUtils.getStandardFilePath('documents'), "Stash.log")
if LrFileUtils.exists( logPath ) then
local success, reason = LrFileUtils.delete( logPath )
if not success then
logger:error("Error deleting existing logfile!" .. reason)
end
end
if prefs.debugLogging == nil then
prefs.debugLogging = false
end
if prefs.debugLogging then
logger:enable("logfile")
else
logger:disable()
logger:enable({
fatal = "logfile",
error = "logfile",
})
end
logger:info("LR/Stash loading.")
logger:info("Version " .. Utils.getVersion() .. " in Lightroom " .. import 'LrApplication'.versionString() .. " running on " .. import 'LrSystemInfo'.summaryString())
if prefs.uploadCount == nil then
prefs.uploadCount = 0
end
if prefs.submitData == nil then
prefs.submitData = true
end
if prefs.autoUpdate == true then
Utils.updatePlugin()
elseif prefs.autoUpdate == false then
-- do nothing
else
prefs.autoUpdate = true
Utils.updatePlugin()
end