资源简介
直接解压unitypackage文件, 无需安装unity工具, 运行需要python环境, 来自 github.com/gered/extractunitypackage, 用法:
extractunitypackage.py input_file [output_path]
代码片段和文件信息
#!/usr/bin/env python
#
# UnityPackage Extractor
#
# Extracts files/folders from a .unitypackage file reading the ‘pathname‘
# files it contains to rebuild a “readable“ file/folder structure.
#
# Usage: extractunitypackage.py input_file [output_path]
#
# “input_file“ should be a .unitypackage file. The part of the filename
# before the extension will be used as the name of the directory that the
# packages contents will be extracted to.
#
# “output_path“ is an optional path where the package‘s files will be
# extracted to. If omitted the current working directory is used. If
# specified the path should already exist.
# Update (by Entwicklerpages): Simple fixes for python3 support. Now works on both versions.
import os
import stat
import shutil
import sys
import tarfile
if len(sys.argv) < 2:
print (‘No input file specified.‘)
sys.exit()
name extension = os.path.splitext(sys.argv[1])
outputDir = ‘‘
if len(sys.argv) > 2:
outputDir = os.path.join(sys.argv[2] name)
else:
outputDir = ‘./‘ + name
workingDir = ‘./.working‘
# can‘t proceed if the output dir exists already
# but if the temp working dir exists we clean it out before extracting
if os.path.exists(outputDir):
print (‘Output dir “‘ + outputDir + ‘“ exists. Aborting.‘)
sys.exit();
if os.path.exists(workingDir):
shutil.rmtree(workingDir)
# extract .unitypackage contents to a temporary space
tar = tarfile.open(sys.argv[1] ‘r:gz‘)
tar.extractall(workingDir);
tar.close()
# build association between the unitypackage‘s root directory names
# (which each have 1 asset in them) to the actual filename (stored in the ‘pathname‘ file)
mapping = {}
for i in os.listdir(workingDir):
ro
- 上一篇:正规式转NFA转DFA转MFA
- 下一篇:Logistics回归
评论
共有 条评论