Skip to content

Commit 14c7b2e

Browse files
committed
Fix so that Shell.setup_system_files works
1 parent 65c8720 commit 14c7b2e

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

mrbgems/picoruby-filesystem-fat/src/fat.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,10 @@ FAT_prepare_exception(FRESULT res, char *buff, const char *func)
7979
PREPARE_EXCEPTION("Storage device not ready");
8080
break;
8181
case FR_NO_FILE:
82+
PREPARE_EXCEPTION("No such file");
83+
break;
8284
case FR_NO_PATH:
83-
PREPARE_EXCEPTION("No such file or directory");
85+
PREPARE_EXCEPTION("No such path");
8486
break;
8587
case FR_INVALID_NAME:
8688
PREPARE_EXCEPTION("Invalid as a path name");

mrbgems/picoruby-filesystem-fat/src/mruby/fat_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ mrb_s_new(mrb_state *mrb, mrb_value klass)
4545
mrb_raise(mrb, E_ARGUMENT_ERROR, "Unknown file open mode");
4646
}
4747
res = f_open(fp, (const TCHAR *)path, mode);
48-
mrb_raise_iff_f_error(mrb, res, "f_open");
48+
mrb_raise_iff_f_error(mrb, res, path);
4949
return file;
5050
}
5151

mrbgems/picoruby-filesystem-fat/src/mrubyc/fat_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ c_new(mrbc_vm *vm, mrbc_value v[], int argc)
3030
mrbc_raise(vm, MRBC_CLASS(ArgumentError), "Unknown file open mode");
3131
}
3232
res = f_open(fp, path, mode);
33-
mrbc_raise_iff_f_error(vm, res, "f_open");
33+
mrbc_raise_iff_f_error(vm, res, path);
3434
_file.instance->cls = class_FAT_File;
3535
SET_RETURN(_file);
3636
}

mrbgems/picoruby-shell/mrblib/shell.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ def self.ensure_system_file(path, code, crc = nil)
7777
File.unlink(path)
7878
sleep_ms 100
7979
else
80+
puts "Writing : #{path}"
8081
File.open(path, "w") do |f|
81-
puts " Writing: #{path}"
8282
f.expand(code.length) if f.respond_to?(:expand)
8383
f.write(code)
8484
end
@@ -98,9 +98,12 @@ def self.setup_system_files(root = nil, force: false)
9898
ENV['PATH'] = "#{root}/bin"
9999
ENV['WIFI_CONFIG_PATH'] = "#{root}/etc/network/wifi.yml"
100100
Dir.chdir(root || "/") do
101-
%w(bin lib var home etc etc/init.d etc/network).each do |dir|
102-
Dir.mkdir(dir) unless Dir.exist?(dir)
103-
sleep_ms 10
101+
%w(bin home etc etc/init.d etc/network var lib).each do |dir|
102+
unless Dir.exist?(dir)
103+
puts "Creating directory: #{dir}"
104+
Dir.mkdir(dir)
105+
sleep 1 # This ensure the directory is created
106+
end
104107
end
105108
while exe = Shell.next_executable
106109
path = "#{root}#{exe[:path]}"

0 commit comments

Comments
 (0)