From 385f74222ae815807c3fcabfd66b291f6537ad31 Mon Sep 17 00:00:00 2001 From: Tigran Aivazian Date: Tue, 25 Sep 2012 13:00:34 +0100 Subject: [PATCH] Create static directories at build, not runtime. Instead of calling lfs.mkdir() to create "./history" and "./screenshots" at runtime it is easier to create them at package build time. I hesitated whether to add "./clipboard" to this list but decided against it as we can perhaps change current directory and then all the code manipulating clipboard would break, so I left it as is. --- Makefile | 2 +- filechooser.lua | 1 - screen.lua | 1 - settings.lua | 1 - 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Makefile b/Makefile index a8e789017..d6b7724c2 100644 --- a/Makefile +++ b/Makefile @@ -216,7 +216,7 @@ customupdate: all $(STRIP) --strip-unneeded kpdfview -rm kindlepdfviewer-$(VERSION).zip rm -Rf $(INSTALL_DIR) - mkdir $(INSTALL_DIR) + mkdir -p $(INSTALL_DIR)/{history,screenshots} echo $(VERSION) > $(INSTALL_DIR)/git-rev cp -p README.md COPYING kpdfview $(LUA_FILES) $(INSTALL_DIR) mkdir $(INSTALL_DIR)/data diff --git a/filechooser.lua b/filechooser.lua index 5d0c1b859..c43467374 100644 --- a/filechooser.lua +++ b/filechooser.lua @@ -450,7 +450,6 @@ function FileChooser:addAllCommands() self.commands:add(KEY_L, nil, "L", "show last documents", function(self) - lfs.mkdir("./history/") FileHistory:init() FileHistory:choose("") self.pagedirty = true diff --git a/screen.lua b/screen.lua index f79bc2708..ee3d9eb56 100644 --- a/screen.lua +++ b/screen.lua @@ -109,7 +109,6 @@ end function Screen:screenshot() - lfs.mkdir("./screenshots") local start = os.clock() --showInfoMsgWithDelay("making screenshot... ", 1000, 1) self:fb2bmp("/dev/fb0", lfs.currentdir().."/screenshots/"..os.date("%Y%m%d%H%M%S")..".bmp", true, nil) diff --git a/settings.lua b/settings.lua index 3374f3136..286803d8b 100644 --- a/settings.lua +++ b/settings.lua @@ -30,7 +30,6 @@ end function DocSettings:open(docfile) -- history feature moves configuration files into history directory - lfs.mkdir("./history") local new = { file = DocToHistory(docfile), data = {} } local ok, stored = pcall(dofile,new.file) if not ok then