Mercurial > games > semicongine
comparison semicongine/resources.nim @ 900:f14b955da09b
fix: yielding duplicates
author | Sam <sam@basx.dev> |
---|---|
date | Wed, 14 Feb 2024 23:15:53 +0700 |
parents | ad961543994b |
children | 0a1e68f32fca |
comparison
equal
deleted
inserted
replaced
899:ad961543994b | 900:f14b955da09b |
---|---|
110 if not (components[0] in yielded): | 110 if not (components[0] in yielded): |
111 yield (kind: pcFile, path: components[0]) | 111 yield (kind: pcFile, path: components[0]) |
112 else: | 112 else: |
113 if not (components[0] in yielded): | 113 if not (components[0] in yielded): |
114 yield (kind: pcDir, path: components[0]) | 114 yield (kind: pcDir, path: components[0]) |
115 yielded.incl components[0] | |
115 archive.close() | 116 archive.close() |
116 | 117 |
117 elif thebundletype == Exe: | 118 elif thebundletype == Exe: |
118 | 119 |
119 import std/compilesettings | 120 import std/compilesettings |
155 if not (components[0] in yielded): | 156 if not (components[0] in yielded): |
156 yield (kind: pcFile, path: components[0]) | 157 yield (kind: pcFile, path: components[0]) |
157 else: | 158 else: |
158 if not (components[0] in yielded): | 159 if not (components[0] in yielded): |
159 yield (kind: pcDir, path: components[0]) | 160 yield (kind: pcDir, path: components[0]) |
161 yielded.incl components[0] | |
160 | 162 |
161 proc loadResource*(path: string, package = DEFAULT_PACKAGE): Stream = | 163 proc loadResource*(path: string, package = DEFAULT_PACKAGE): Stream = |
162 loadResource_intern(path, package = package) | 164 loadResource_intern(path, package = package) |
163 | 165 |
164 proc loadImage*[T](path: string, package = DEFAULT_PACKAGE): Image[RGBAPixel] = | 166 proc loadImage*[T](path: string, package = DEFAULT_PACKAGE): Image[RGBAPixel] = |