diff --git a/config.ld b/config.ld index 894d500..eb77b17 100644 --- a/config.ld +++ b/config.ld @@ -4,6 +4,7 @@ output = "api" title = "Winapi documentation" project = "winapi" readme = "readme.md" +one = true -- no_summary = true examples = {'examples', exclude = {'examples/slow.lua'}} description = [[ diff --git a/examples/test-wexec.lua b/examples/test-wexec.lua deleted file mode 100644 index 1c09128..0000000 --- a/examples/test-wexec.lua +++ /dev/null @@ -1,52 +0,0 @@ -require 'winapi' - -local long = 'ελληνική.txt' -local UTF8 = winapi.CP_UTF8 -winapi.set_encoding(UTF8) - -function winapi.tmpname () return os.getenv('TEMP')..os.tmpname() end -function winapi.execute_unicode(cmd) - local tmpfile = winapi.tmpname() - cmd = os.getenv('COMSPEC')..' /u /c '..cmd..' > "'..tmpfile..'"' - local P,err = winapi.spawn(cmd) - if not P then return nil,err end - local res,f,out - res = P:wait():exit_code() - f = io.open(tmpfile) - out = f:read '*a' - f:close() - os.remove(tmpfile) - out, err = winapi.encode(-1,winapi.CP_UTF8,out) - if err then return nil,err end - return res,out -end -local function exec_cmd (cmd,arg) - local res,err = winapi.execute(cmd..' "'..arg..'"') - if res == 0 then return true - else return nil,err - end -end -function winapi.mkdir(dir) return exec_cmd('mkdir',dir) end -function winapi.rmdir(dir) return exec_cmd('rmdir',dir) end -function winapi.delete(file) return exec_cmd('del',file) end -function winapi.get_files(mask,subdirs,attrib) - local flags = '/B ' - if subdirs then flags = flags..' /S' end - if attrib then flags = flags..' /A:'..attrib end - local ret, text = winapi.execute_unicode('dir '..flags..' "'..mask..'"') - if ret ~= 0 then return nil,text end - return text:gmatch('[^\r\n]+') -end -function winapi.get_dirs(mask,subdirs) return winapi.get_files(mask,subdirs,'D') end - -files,err = winapi.get_files ('*.txt',false) -if not files then return print(err) end -for f in files do print(f) end - - - - - - - - diff --git a/readme.md b/readme.md index 7251afc..8ef6f13 100644 --- a/readme.md +++ b/readme.md @@ -219,7 +219,7 @@ To get all the current processes: ## Drive and Directory Operations -There are functions for querying the filesystem: @{get_logical_drives()} returns all available drives (in 'D:\\' format) and @{get_drive_type()} will tell you whether these drives are fixed, remote, removable, etc. @{get_disk_free_space()} will return the space used and the space available in kB as two results. +There are functions for querying the filesystem: @{get_logical_drives} returns all available drives (in 'D:\\' format) and @{get_drive_type} will tell you whether these drives are fixed, remote, removable, etc. @{get_disk_free_space} will return the space used and the space available in kB as two results. require 'winapi'