source: Daodan/MinGW/libexec/mingw-get/setup.lua@ 1109

Last change on this file since 1109 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 2.5 KB
RevLine 
[1046]1--
2-- setup.lua
3--
4-- $Id: setup.lua,v 49e57abe7f83 2013/09/21 08:35:52 keithmarshall $
5--
6-- Lua 5.2 module providing common setup hooks for mingw-get.
7--
8--
9-- This file is a component of mingw-get.
10--
11-- Written by Keith Marshall <keithmarshall@users.sourceforge.net>
12-- Copyright (C) 2012, 2013, MinGW.org Project
13--
14--
15-- Permission is hereby granted, free of charge, to any person obtaining a
16-- copy of this software and associated documentation files (the "Software"),
17-- to deal in the Software without restriction, including without limitation
18-- the rights to use, copy, modify, merge, publish, distribute, sublicense,
19-- and/or sell copies of the Software, and to permit persons to whom the
20-- Software is furnished to do so, subject to the following conditions:
21--
22-- The above copyright notice and this permission notice shall be included
23-- in all copies or substantial portions of the Software.
24--
25-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
26-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
28-- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
30-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
31-- DEALINGS IN THE SOFTWARE.
32--
33 local M = {}
34 local wsh = require "wsh"
35--
36 function M.libexec_path( script, subsystem )
37 if not subsystem
38 then
39 subsystem = "mingw-get"
40 end
41 return wsh.libexec_path( script, subsystem )
42 end
43--
44 function M.argwrap( arglist, ... )
45 for argind, argval in ipairs {...}
46 do
47 arglist = arglist .. " " .. argval
48 end
49 return arglist
50 end
51--
52 function M.shlink( args, ... )
53 if args
54 then
55 wsh.execute( M.argwrap( M.libexec_path( "shlink.js" ), args, ... ) )
56 end
57 end
58--
59 function M.unlink( args, ... )
60 if args
61 then
62 wsh.execute( M.argwrap( M.libexec_path( "unlink.js" ), args, ... ) )
63 end
64 end
65--
66 function M.create_shortcuts( ... )
67 M.shlink( os.getenv( "MINGW_GET_DESKTOP_HOOK" ), ... )
68 M.shlink( os.getenv( "MINGW_GET_START_MENU_HOOK" ), ... )
69 end
70--
71 function M.delete_shortcuts( ... )
72 M.unlink( "--desktop", ... )
73 M.unlink( "--all-users --desktop", ... )
74 M.unlink( "--all-users --start-menu", ... )
75 M.unlink( "--start-menu", ... )
76 end
77--
78 return M
79--
80-- $RCSfile: setup.lua,v $: end of file */
Note: See TracBrowser for help on using the repository browser.