MCPcopy Create free account
hub / github.com/MarlinFirmware/Marlin / hide

Method hide

Marlin/src/sd/SdBaseFile.cpp:1685–1705  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1683}
1684
1685bool SdBaseFile::hide(const bool hidden) {
1686 if (ENABLED(SDCARD_READONLY)) return false;
1687 // must be an open file or subdirectory
1688 if (!(isFile() || isSubDir())) return false;
1689 // sync() and cache directory entry
1690 sync();
1691 dir_t *d = cacheDirEntry(SdVolume::CACHE_FOR_WRITE);
1692 if (!d) return false;
1693 uint8_t a = d->attributes;
1694 if (hidden)
1695 a |= DIR_ATT_HIDDEN;
1696 else
1697 a &= ~DIR_ATT_HIDDEN;
1698
1699 if (a != d->attributes) {
1700 d->attributes = a;
1701 return vol_->cacheFlush();
1702 }
1703
1704 return true;
1705}
1706
1707/**
1708 * Rename a file or subdirectory.

Callers 3

bootstrap.min.jsFile · 0.45
iFunction · 0.45

Calls 2

syncFunction · 0.85
cacheFlushMethod · 0.80

Tested by

no test coverage detected