Skip to content

Fix utime(s) with FILESYSTEM=0 #16070

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ LibraryManager.library = {
// utime.h
// ==========================================================================

$setFileTime__deps: ['$setErrNo'],
#if FILESYSTEM
$setFileTime__deps: ['$FS', '$setErrNo'],
$setFileTime: function(path, time) {
path = UTF8ToString(path);
try {
Expand All @@ -85,8 +86,17 @@ LibraryManager.library = {
return -1;
}
},
#else
$setFileTime__deps: ['$setErrNo'],
$setFileTime: function(path, time) {
// No filesystem support; return an error as if the file does not exist
// (which it almost certainly does not, except for standard streams).
setErrNo({{{ cDefine('ENOENT') }}});
return -1;
},
#endif

utime__deps: ['$FS', '$setFileTime'],
utime__deps: ['$setFileTime'],
utime__proxy: 'sync',
utime__sig: 'iii',
utime: function(path, times) {
Expand All @@ -103,7 +113,7 @@ LibraryManager.library = {
return setFileTime(path, time);
},

utimes__deps: ['$FS', '$setFileTime'],
utimes__deps: ['$setFileTime'],
utimes__proxy: 'sync',
utimes__sig: 'iii',
utimes: function(path, times) {
Expand Down