[Sugar-devel] [PATCH sugar] Only show DOCUMENTS folder when it is not $HOME
Samuel Greenfeld
greenfeld at laptop.org
Fri Sep 2 11:25:07 EDT 2011
Shouldn't we be comparing normalized versions of paths in case symbolic
links are present, or there are extra "." or "/" characters present?
I'm not sure if the string comparison proposed is guaranteed to work in all
cases.
On Fri, Sep 2, 2011 at 11:02 AM, Simon Schampijer <simon at schampijer.de>wrote:
> 'xdg-user-dir DOCUMENTS' will return $HOME when DOCUMENTS
> does not exist, only display the DOCUMENTS folder
> when the actual folder exists
>
> Signed-off-by: Simon Schampijer <simon at laptop.org>
> ---
> src/jarabe/journal/volumestoolbar.py | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/src/jarabe/journal/volumestoolbar.py
> b/src/jarabe/journal/volumestoolbar.py
> index 84d9e31..3aa37da 100644
> --- a/src/jarabe/journal/volumestoolbar.py
> +++ b/src/jarabe/journal/volumestoolbar.py
> @@ -68,7 +68,8 @@ def _get_documents_path():
> pipe = subprocess.Popen(['xdg-user-dir', 'DOCUMENTS'],
> stdout=subprocess.PIPE)
> documents_path = pipe.communicate()[0].strip()
> - if os.path.exists(documents_path):
> + if os.path.exists(documents_path) and \
> + os.environ.get('HOME') + '/' != documents_path:
> return documents_path
> except OSError, exception:
> if exception.errno != errno.ENOENT:
> --
> 1.7.4.4
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20110902/254d0f72/attachment.html>
More information about the Sugar-devel
mailing list