通过 aaptOptions 使 android 从“_next”资产文件夹中复制所有内容
Make android copy all from "_next" asset folder via aaptOptions
我最近发现 android 会忽略以 _
开头的资产文件夹,并且 aaptOptions { ignoreAssetsPattern }
可以用来覆盖它。
我四处搜索并找到了这样的例子
aaptOptions {
ignoreAssetsPattern '!.svg:!.woff:!.jpg:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~'
}
我假设对单个文件执行此操作?但我想澄清是否可以将所有文件包含在 _next
资产文件夹中,而不是指定每个单独的文件?
如果不是,您能否阐明 !.svg
和 !*.scc
之间的区别以及最后的 !*~
是什么意思?
ignoreAssetsPattern 仅记录在 sources 中,如果您使用构建工具使用选项 --ignore-asset
自行编译,则只有一个默认值,默认模式是:
!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~
格式规则如下:
* Patterns syntax:
* - Delimiter is :
* - Entry can start with the flag ! to avoid printing a warning
* about the file being ignored.
* - Entry can have the flag "<dir>" to match only directories
* or <file> to match only files. Default is to match both.
* - Entry can be a simplified glob "<prefix>*" or "*<suffix>"
* where prefix/suffix must have at least 1 character (so that
* we don't match a '*' catch-all pattern.)
* - The special filenames "." and ".." are always ignored.
* - Otherwise the full string is matched.
* - match is not case-sensitive.
因此,为了回答您所有的问题,!.svg
和 !*.scc
之间的区别在于,第一个将忽略名为“.svg”的文件或文件夹的资产模式,但是,第二个,将忽略所有具有 .scc 扩展名的文件或文件夹的资产模式,!*~
的意思是忽略所有以符号 ~ 结尾的文件或文件夹
适合您的情况的正确配置是:
aaptOptions {
ignoreAssetsPattern '!_*'
}
因此它将忽略所有以“_”开头的文件和文件夹的资产模式
我最近发现 android 会忽略以 _
开头的资产文件夹,并且 aaptOptions { ignoreAssetsPattern }
可以用来覆盖它。
我四处搜索并找到了这样的例子
aaptOptions {
ignoreAssetsPattern '!.svg:!.woff:!.jpg:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~'
}
我假设对单个文件执行此操作?但我想澄清是否可以将所有文件包含在 _next
资产文件夹中,而不是指定每个单独的文件?
如果不是,您能否阐明 !.svg
和 !*.scc
之间的区别以及最后的 !*~
是什么意思?
ignoreAssetsPattern 仅记录在 sources 中,如果您使用构建工具使用选项 --ignore-asset
自行编译,则只有一个默认值,默认模式是:
!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~
格式规则如下:
* Patterns syntax:
* - Delimiter is :
* - Entry can start with the flag ! to avoid printing a warning
* about the file being ignored.
* - Entry can have the flag "<dir>" to match only directories
* or <file> to match only files. Default is to match both.
* - Entry can be a simplified glob "<prefix>*" or "*<suffix>"
* where prefix/suffix must have at least 1 character (so that
* we don't match a '*' catch-all pattern.)
* - The special filenames "." and ".." are always ignored.
* - Otherwise the full string is matched.
* - match is not case-sensitive.
因此,为了回答您所有的问题,!.svg
和 !*.scc
之间的区别在于,第一个将忽略名为“.svg”的文件或文件夹的资产模式,但是,第二个,将忽略所有具有 .scc 扩展名的文件或文件夹的资产模式,!*~
的意思是忽略所有以符号 ~ 结尾的文件或文件夹
适合您的情况的正确配置是:
aaptOptions {
ignoreAssetsPattern '!_*'
}
因此它将忽略所有以“_”开头的文件和文件夹的资产模式