err_t Application::getWorkingDirectory(StringW& dst) { size_t capacity = 256; for (;;) { CharW* buf = dst._prepare(CONTAINER_OP_REPLACE, capacity); capacity = dst.getCapacity(); if (FOG_IS_NULL(buf)) return ERR_RT_OUT_OF_MEMORY; size_t length = ::GetCurrentDirectoryW( static_cast<DWORD>(Math::min<size_t>(dst.getCapacity() + 1, UINT32_MAX)), reinterpret_cast<wchar_t*>(buf)); if (capacity < length) { capacity = length; continue; } dst._modified(buf + length); return dst.normalizeSlashes(SLASH_FORM_UNIX); } }