Mercurial > vim-crosoft
comparison scripts/list_sln_files.py @ 8:d5ddd9ffaf11
Don't crash trying to list a solution file if no cache exists yet.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 24 Sep 2020 22:56:34 -0700 |
parents | bac97082e229 |
children | cfcac4ed7d21 |
comparison
equal
deleted
inserted
replaced
7:ff4590b2503a | 8:d5ddd9ffaf11 |
---|---|
29 args = parser.parse_args(args) | 29 args = parser.parse_args(args) |
30 setup_logging(args.verbose) | 30 setup_logging(args.verbose) |
31 | 31 |
32 cache, loaded = SolutionCache.load_or_rebuild(args.solution, args.cache) | 32 cache, loaded = SolutionCache.load_or_rebuild(args.solution, args.cache) |
33 if loaded and args.list_cache: | 33 if loaded and args.list_cache: |
34 cache_dt = os.path.getmtime(args.cache) | 34 caches_exist = True |
35 list_cache_dt = os.path.getmtime(args.list_cache) | 35 try: |
36 if list_cache_dt > cache_dt: | 36 cache_dt = os.path.getmtime(args.cache) |
37 list_cache_dt = os.path.getmtime(args.list_cache) | |
38 except OSError: | |
39 caches_exist = False | |
40 if caches_exist and list_cache_dt > cache_dt: | |
37 logger.debug("Solution cache was valid, re-using the file list cache.") | 41 logger.debug("Solution cache was valid, re-using the file list cache.") |
38 try: | 42 try: |
39 with open(args.list_cache, 'r') as fp: | 43 with open(args.list_cache, 'r') as fp: |
40 print(fp.read()) | 44 print(fp.read()) |
41 return | 45 return |