From 1ba7bebce6863d5b5f70f64eea0325fafd6e557a Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Tue, 9 Feb 2021 20:12:38 -0500 Subject: [PATCH] Handle lack of a Documents directory --- libs/kiplatform/gtk/environment.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/kiplatform/gtk/environment.cpp b/libs/kiplatform/gtk/environment.cpp index cdb204c811..df9c9fdc77 100644 --- a/libs/kiplatform/gtk/environment.cpp +++ b/libs/kiplatform/gtk/environment.cpp @@ -61,6 +61,10 @@ wxString KIPLATFORM::ENV::GetDocumentsPath() fallback.AppendDir( "Documents" ); fallback.MakeAbsolute(); + // No Documents dir and nothing from XDG? Give up and use $HOME + if( !fallback.DirExists() || !fallback.IsDirWritable() ) + fallback.RemoveLastDir(); + docsPath = fallback.GetFullPath(); }