| 1683 | } |
| 1684 | |
| 1685 | bool 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. |
no test coverage detected