Skip to content

Commit 358f264

Browse files
committed
update to ensure path building is always os-dependent and to ensure all paths for binaries and such look within the build folder
1 parent c20ced1 commit 358f264

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

programmer.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def main():
2828
# load flasher_args.json. flasher_args.json is a json file that contains the
2929
# arguments to be passed to esptool this file is generated by the build
3030
# script
31-
flasher_args_file = open(resource_path('build/flasher_args.json'), 'r')
31+
flasher_args_file = open(resource_path(os.path.join('build', 'flasher_args.json')), 'r')
3232
flasher_args = json.loads(flasher_args_file.read())
3333
print(f'Loaded flasher args: {flasher_args}')
3434

@@ -50,8 +50,9 @@ def main():
5050

5151
for offset, filepath in flasher_args['flash_files'].items():
5252
command.append(offset)
53-
# convert the filename to use resource path
54-
command.append(resource_path(filepath))
53+
# prepend the filepath with build/ and convert it using resource_path
54+
actual_path = resource_path(os.path.join('build', filepath))
55+
command.append(actual_path)
5556

5657
# if the --no-fs flag is set, then we should NOT look for -flash_args files
5758
if args.no_fs:
@@ -72,7 +73,7 @@ def main():
7273
# if the filename contains '-flash_args', then we should process it
7374
if '-flash_args' in filename:
7475
print(f'Found {filename}...')
75-
flash_args_file = open(resource_path('build/' + filename), 'r').read()
76+
flash_args_file = open(resource_path(os.path.join('build', filename)), 'r').read()
7677
# split the file by newline
7778
for line in flash_args_file.splitlines():
7879
print(f'Processing line: {line}')
@@ -81,7 +82,7 @@ def main():
8182
offset, binary = line.split(' ')
8283
print(f'Found offset: {offset} and binary: {binary}')
8384
command.append(offset)
84-
command.append(resource_path(binary))
85+
command.append(resource_path(os.path.join('build', binary)))
8586
print(f'Added {offset} and {resource_path(binary)} to command')
8687

8788
# if the port argument is provided, add it to the command

0 commit comments

Comments
 (0)