delete in chunks
This commit is contained in:
27
PKGBUILD
27
PKGBUILD
@@ -1,27 +0,0 @@
|
||||
pkgname=dull-git
|
||||
pkgver=0.1
|
||||
pkgrel=1
|
||||
pkgdesc="Desktop app for securely storing sensitive files"
|
||||
arch=('x86_64')
|
||||
url="https://github.com/antpiasecki/dull"
|
||||
depends=('qt6-base' 'botan')
|
||||
makedepends=('cmake' 'git')
|
||||
source=("git+${url}.git")
|
||||
sha256sums=('SKIP')
|
||||
options=('!debug')
|
||||
|
||||
pkgver() {
|
||||
cd "${pkgname%-git}"
|
||||
git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "${pkgname%-git}"
|
||||
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
|
||||
cmake --build build -j$(nproc)
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "${pkgname%-git}/build"
|
||||
make DESTDIR="${pkgdir}" install
|
||||
}
|
||||
@@ -4,7 +4,7 @@ Desktop app for securely storing sensitive files
|
||||
|
||||
## Features
|
||||
* **Pretty usable UI**
|
||||
* **Overkill encryption:** XChaCha20-Poly1305 + Argon2id(m=1GB,t=6,p=4) key derivation
|
||||
* **Overkill encryption:** XChaCha20-Poly1305 + Argon2id(m=1GB,t=8,p=4) key derivation
|
||||
* **Cross-platform-ish:** Builds on Linux, Windows and macOS
|
||||
* **Drag and Drop support**
|
||||
|
||||
@@ -21,8 +21,11 @@ cmake --build build -j $(nproc)
|
||||
|
||||
### Arch
|
||||
```
|
||||
sudo pacman -S base-devel
|
||||
makepkg -si
|
||||
sudo pacman -Syu base-devel cmake qt6-base botan
|
||||
|
||||
cmake -S . -B build
|
||||
cmake --build build -j $(nproc)
|
||||
./build/dull
|
||||
```
|
||||
|
||||
### Windows (MSYS2)
|
||||
|
||||
26
src/vault.cc
26
src/vault.cc
@@ -143,21 +143,29 @@ void Vault::delete_file(const std::string &filename) {
|
||||
if (entry_start != -1) {
|
||||
i64 entry_end = entry_start + static_cast<i64>(entry_total_size);
|
||||
|
||||
i64 read_pos = entry_end;
|
||||
i64 write_pos = entry_start;
|
||||
std::array<u8, 65536> buffer{};
|
||||
while (true) {
|
||||
m_file.clear();
|
||||
m_file.seekg(entry_end, std::ios::beg);
|
||||
std::string remaining;
|
||||
remaining.assign(std::istreambuf_iterator<char>(m_file),
|
||||
std::istreambuf_iterator<char>());
|
||||
m_file.seekg(read_pos);
|
||||
m_file.read(to_char_ptr(buffer.data()), buffer.size());
|
||||
auto bytes = m_file.gcount();
|
||||
if (bytes == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
m_file.clear();
|
||||
m_file.seekp(entry_start, std::ios::beg);
|
||||
ASSERT(m_file.write(remaining.data(), static_cast<i64>(remaining.size())));
|
||||
m_file.seekp(write_pos);
|
||||
ASSERT(m_file.write(to_char_ptr(buffer.data()), bytes));
|
||||
|
||||
read_pos += bytes;
|
||||
write_pos += bytes;
|
||||
}
|
||||
|
||||
i64 new_size = entry_start + static_cast<i64>(remaining.size());
|
||||
m_file.flush();
|
||||
m_file.close();
|
||||
|
||||
std::filesystem::resize_file(m_path, new_size);
|
||||
std::filesystem::resize_file(m_path, write_pos);
|
||||
|
||||
m_file.open(m_path, std::ios::in | std::ios::out | std::ios::binary);
|
||||
ASSERT(m_file.good());
|
||||
|
||||
Reference in New Issue
Block a user