webmcp
diff framework/env/encode/file_path.lua @ 0:9fdfb27f8e67
Version 1.0.0
author | jbe/bsw |
---|---|
date | Sun Oct 25 12:00:00 2009 +0100 (2009-10-25) |
parents | |
children | 3d43a5cf17c1 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/framework/env/encode/file_path.lua Sun Oct 25 12:00:00 2009 +0100 1.3 @@ -0,0 +1,21 @@ 1.4 +--[[-- 1.5 +path = -- string containing a (file) path 1.6 +encode.encode_file_path( 1.7 + base_path, 1.8 + element1, -- next part of the path 1.9 + element2, -- next part of the path 1.10 + ... 1.11 +) 1.12 + 1.13 +This function does the same as encode.concat_file_path, except that all arguments but the first are encoded using the encode.file_path_element function. 1.14 + 1.15 +--]]-- 1.16 + 1.17 +function encode.file_path(base, ...) -- base argument is not encoded 1.18 + local raw_elements = {...} 1.19 + local encoded_elements = {} 1.20 + for i = 1, #raw_elements do 1.21 + encoded_elements[i] = encode.file_path_element(raw_elements[i]) 1.22 + end 1.23 + return encode.concat_file_path(base, unpack(encoded_elements)) 1.24 +end