mirror of
https://github.com/status-im/re-natal.git
synced 2025-02-05 09:13:24 +00:00
.DS_Store file is "required" by node if found in the images directory
If a .DS_Store file is created by OS X in the images directory then natal will attempt to require it like any other image file. This causes an error in the simulator as javascript cannot load the file. As there isnt any reason why a .DS_Store file should be loaded I've added an automatic exclusion for this file name in any part of the image path. Additions that could be made: We could expose the exclude list as a configuration in the .re-natal file so that people could see what is being excluded and add to it if needed.
This commit is contained in:
parent
9e610170cd
commit
180427e6b6
@ -216,15 +216,20 @@ scanImageDir = (dir) ->
|
||||
fnames = fs.readdirSync(dir)
|
||||
.map (fname) -> "#{dir}/#{fname}"
|
||||
.filter (path) -> fs.statSync(path).isFile()
|
||||
.filter (path) -> removeExcludeFiles(path)
|
||||
.map (path) -> path.replace /@2x|@3x/i, ''
|
||||
.filter (v, idx, slf) -> slf.indexOf(v) == idx
|
||||
|
||||
dirs = fs.readdirSync(dir)
|
||||
.map (fname) -> "#{dir}/#{fname}"
|
||||
.filter (path) -> fs.statSync(path).isDirectory()
|
||||
|
||||
fnames.concat scanImages(dirs)
|
||||
|
||||
removeExcludeFiles = (file) ->
|
||||
excludedFileNames = [".DS_Store"]
|
||||
res = excludedFileNames.map (ex) -> (file.indexOf ex) == -1
|
||||
true in res
|
||||
|
||||
scanImages = (dirs) ->
|
||||
imgs = []
|
||||
for dir in dirs
|
||||
|
Loading…
x
Reference in New Issue
Block a user