diff options
author | Jeff Garzik <jgarzik@exmulti.com> | 2012-09-04 21:40:26 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2012-09-04 21:40:26 -0400 |
commit | 42613c97d5dd8581d8dfd2cbe443736f8c539973 (patch) | |
tree | 964756d588a5ccabe5c4120d86df29093c29e060 /src | |
parent | dcb14198bb2b55a673aa27bc5fa036d809556dbe (diff) |
Add block file naming helper, BlockFilePath()
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index 38d2b96f80..9e2ebb932e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1991,11 +1991,17 @@ bool CheckDiskSpace(uint64 nAdditionalBytes) return true; } +static filesystem::path BlockFilePath(unsigned int nFile) +{ + string strBlockFn = strprintf("blk%04d.dat", nFile); + return GetDataDir() / strBlockFn; +} + FILE* OpenBlockFile(unsigned int nFile, unsigned int nBlockPos, const char* pszMode) { if ((nFile < 1) || (nFile == (unsigned int) -1)) return NULL; - FILE* file = fopen((GetDataDir() / strprintf("blk%04d.dat", nFile)).string().c_str(), pszMode); + FILE* file = fopen(BlockFilePath(nFile).string().c_str(), pszMode); if (!file) return NULL; if (nBlockPos != 0 && !strchr(pszMode, 'a') && !strchr(pszMode, 'w')) |