Skip to content

Commit 196c317

Browse files
author
Kazuki Suzuki
authored
Add files via upload
1 parent c62c428 commit 196c317

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

pyneofile.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Features:
99
- Pack / unpack / repack / archive_to_array
1010
- Validation and listing helpers (lowercase names)
11-
- INI-driven format detection (prefers PYNEOFILE_INI / pyneofile.ini)
11+
- INI-driven format detection (prefers PYNEOFILE_INI / neofile.ini)
1212
- Compression: zlib, gzip, bz2 (stdlib), xz/lzma when available (Py3)
1313
- Size-based 'auto' compression policy
1414
- Checksums (header/json/content) using stored bytes (padded CRC-32)
@@ -53,6 +53,10 @@
5353
_lzma = None
5454
_HAVE_LZMA = False
5555

56+
57+
__use_env_file__ = True
58+
__use_ini_file__ = True
59+
__use_ini_name__ = "neofile.ini"
5660
__program_name__ = "PyNeoFile"
5761
__project__ = __program_name__
5862
__project_url__ = "https://github.com/GameMaker2k/PyNeoFile"
@@ -61,7 +65,7 @@
6165
__version_date__ = str(__version_date_info__[0]) + "." + str(
6266
__version_date_info__[1]).zfill(2) + "." + str(__version_date_info__[2]).zfill(2)
6367
__revision__ = __version_info__[3]
64-
__revision_id__ = "$Id$"
68+
__revision_id__ = "$Id: e8f430ca2dd331b705df7e8107d81e61ea796166 $"
6569
if(__version_info__[4] is not None):
6670
__version_date_plusrc__ = __version_date__ + \
6771
"-" + str(__version_date_info__[4])
@@ -363,7 +367,7 @@ def _load_formatspecs_from_ini(paths=None, prefer_section=None):
363367
Search order:
364368
- explicit 'paths'
365369
- env PYNEOFILE_INI, then PYARCHIVE_INI
366-
- ./pyneofile.ini, ./archivefile.ini, ./catfile.ini, ./foxfile.ini
370+
- ./neofile.ini
367371
Section selection:
368372
- prefer_section
369373
- [config] default=... if present
@@ -375,10 +379,12 @@ def _load_formatspecs_from_ini(paths=None, prefer_section=None):
375379
cands.append(paths)
376380
else:
377381
cands.extend(paths)
378-
envp = os.environ.get('PYNEOFILE_INI') or os.environ.get('PYARCHIVE_INI')
382+
if(__use_env_file__):
383+
envp = os.environ.get('PYNEOFILE_INI')
379384
if envp:
380385
cands.append(envp)
381-
cands.extend(['pyneofile.ini'])
386+
if(__use_ini_file__):
387+
cands.extend([__use_ini_name__])
382388

383389
picked = None
384390
for p in cands:

0 commit comments

Comments
 (0)