57 lines
1.3 KiB
Plaintext
Executable File
57 lines
1.3 KiB
Plaintext
Executable File
--
|
|
-- File:: %RS_TOOLSLIB%/util/ragebuilder/archive.rbs
|
|
-- Description:: Asset archive mount/unmount wrapper and helper functions.
|
|
--
|
|
-- Author:: David Muir <david.muir@rockstarnorth.com>
|
|
-- Date:: 14 March 2011
|
|
--
|
|
|
|
--
|
|
-- name: matchespattern
|
|
-- desc: Determine whether text matches a specified pattern.
|
|
--
|
|
function matchespattern( text, pattern, start )
|
|
|
|
findres = string.find( text, pattern, start )
|
|
if ( nil ~= findres ) then
|
|
return ( true )
|
|
else
|
|
return ( false )
|
|
end
|
|
end
|
|
|
|
--
|
|
-- name: isCoreAssetInZip
|
|
-- desc: Determine whether asset filename is a core asset in a zip file.
|
|
--
|
|
function isCoreAssetInZip( filename )
|
|
|
|
return ( matchespattern( filename, "%.%a+%.zip" ) ~= nil )
|
|
end
|
|
|
|
--
|
|
-- name: mount
|
|
-- desc: mount archive based on extension String.
|
|
--
|
|
function mount( input, mount )
|
|
if ( matchespattern( input, "%.zip" ) ) then
|
|
mount_zip( input, mount )
|
|
else
|
|
mount_pack( input, mount )
|
|
end
|
|
end
|
|
|
|
--
|
|
-- name: unmount
|
|
-- desc: unmount archive based on extension string.
|
|
--
|
|
function unmount( input )
|
|
if ( matchespattern( input, "%.zip" ) ) then
|
|
unmount_zip( input )
|
|
else
|
|
unmount_pack( input )
|
|
end
|
|
end
|
|
|
|
-- %RS_TOOLSLIB%/util/ragebuilder/archive.rbs
|