82391de567696f10b21a762fde6a06fe3c266d28vboxsync * DnD: Directory handling.
82391de567696f10b21a762fde6a06fe3c266d28vboxsync * Copyright (C) 2014 Oracle Corporation
82391de567696f10b21a762fde6a06fe3c266d28vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
82391de567696f10b21a762fde6a06fe3c266d28vboxsync * available from http://www.virtualbox.org. This file is free software;
82391de567696f10b21a762fde6a06fe3c266d28vboxsync * you can redistribute it and/or modify it under the terms of the GNU
82391de567696f10b21a762fde6a06fe3c266d28vboxsync * General Public License (GPL) as published by the Free Software
82391de567696f10b21a762fde6a06fe3c266d28vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
82391de567696f10b21a762fde6a06fe3c266d28vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
82391de567696f10b21a762fde6a06fe3c266d28vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
82391de567696f10b21a762fde6a06fe3c266d28vboxsync/******************************************************************************
82391de567696f10b21a762fde6a06fe3c266d28vboxsync * Header Files *
82391de567696f10b21a762fde6a06fe3c266d28vboxsync ******************************************************************************/
82391de567696f10b21a762fde6a06fe3c266d28vboxsync if (RTStrPrintf(pszDropDir, cbDropDir, "%s", pszPath) <= 0)
82391de567696f10b21a762fde6a06fe3c266d28vboxsync /** @todo On Windows we also could use the registry to override
82391de567696f10b21a762fde6a06fe3c266d28vboxsync * this path, on Posix a dotfile and/or a guest property
82391de567696f10b21a762fde6a06fe3c266d28vboxsync * can be used. */
82391de567696f10b21a762fde6a06fe3c266d28vboxsync /* Append our base drop directory. */
82391de567696f10b21a762fde6a06fe3c266d28vboxsync int rc = RTPathAppend(pszDropDir, cbDropDir, "VirtualBox Dropped Files");
82391de567696f10b21a762fde6a06fe3c266d28vboxsync /* Create it when necessary. */
82391de567696f10b21a762fde6a06fe3c266d28vboxsync rc = RTDirCreateFullPath(pszDropDir, RTFS_UNIX_IRWXU);
82391de567696f10b21a762fde6a06fe3c266d28vboxsync /* The actually drop directory consist of the current time stamp and a
82391de567696f10b21a762fde6a06fe3c266d28vboxsync * unique number when necessary. */
82391de567696f10b21a762fde6a06fe3c266d28vboxsync if (!RTTimeSpecToString(RTTimeNow(&time), pszTime, sizeof(pszTime)))
82391de567696f10b21a762fde6a06fe3c266d28vboxsync rc = DnDPathSanitizeFilename(pszTime, sizeof(pszTime));
82391de567696f10b21a762fde6a06fe3c266d28vboxsync /* Create it (only accessible by the current user) */
82391de567696f10b21a762fde6a06fe3c266d28vboxsync return RTDirCreateUniqueNumbered(pszDropDir, cbDropDir, RTFS_UNIX_IRWXU, 3, '-');
82391de567696f10b21a762fde6a06fe3c266d28vboxsyncint DnDDirCreateDroppedFiles(char *pszDropDir, size_t cbDropDir)
82391de567696f10b21a762fde6a06fe3c266d28vboxsync /* Get the user's temp directory. Don't use the user's root directory (or
82391de567696f10b21a762fde6a06fe3c266d28vboxsync * something inside it) because we don't know for how long/if the data will
82391de567696f10b21a762fde6a06fe3c266d28vboxsync * be kept after the guest OS used it. */