RTPathGetCurrentOnDrive-generic.cpp revision 1eda04de692c4c416332941e87bab4cc8fc45a18
49cf4170d0b586551527ebf4297f8a3fe6bd71a3Lennart Poettering * IPRT - RTPathGetCurrentOnDrive, generic implementation.
49cf4170d0b586551527ebf4297f8a3fe6bd71a3Lennart Poettering * Copyright (C) 2014 Oracle Corporation
49cf4170d0b586551527ebf4297f8a3fe6bd71a3Lennart Poettering * This file is part of VirtualBox Open Source Edition (OSE), as
49cf4170d0b586551527ebf4297f8a3fe6bd71a3Lennart Poettering * available from http://www.virtualbox.org. This file is free software;
49cf4170d0b586551527ebf4297f8a3fe6bd71a3Lennart Poettering * you can redistribute it and/or modify it under the terms of the GNU
49cf4170d0b586551527ebf4297f8a3fe6bd71a3Lennart Poettering * General Public License (GPL) as published by the Free Software
49cf4170d0b586551527ebf4297f8a3fe6bd71a3Lennart Poettering * Foundation, in version 2 as it comes in the "COPYING" file of the
49cf4170d0b586551527ebf4297f8a3fe6bd71a3Lennart Poettering * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
49cf4170d0b586551527ebf4297f8a3fe6bd71a3Lennart Poettering * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
49cf4170d0b586551527ebf4297f8a3fe6bd71a3Lennart Poettering * The contents of this file may alternatively be used under the terms
49cf4170d0b586551527ebf4297f8a3fe6bd71a3Lennart Poettering * of the Common Development and Distribution License Version 1.0
49cf4170d0b586551527ebf4297f8a3fe6bd71a3Lennart Poettering * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
49cf4170d0b586551527ebf4297f8a3fe6bd71a3Lennart Poettering * VirtualBox OSE distribution, in which case the provisions of the
49cf4170d0b586551527ebf4297f8a3fe6bd71a3Lennart Poettering * CDDL are applicable instead of those of the GPL.
49cf4170d0b586551527ebf4297f8a3fe6bd71a3Lennart Poettering * You may elect to license modified versions of this file under the
49cf4170d0b586551527ebf4297f8a3fe6bd71a3Lennart Poettering * terms and conditions of either the GPL or the CDDL or both.
49cf4170d0b586551527ebf4297f8a3fe6bd71a3Lennart Poettering/*******************************************************************************
49cf4170d0b586551527ebf4297f8a3fe6bd71a3Lennart Poettering* Header Files *
49cf4170d0b586551527ebf4297f8a3fe6bd71a3Lennart Poettering*******************************************************************************/
49cf4170d0b586551527ebf4297f8a3fe6bd71a3Lennart PoetteringRTDECL(int) RTPathGetCurrentOnDrive(char chDrive, char *pszPath, size_t cbPath)
49cf4170d0b586551527ebf4297f8a3fe6bd71a3Lennart Poettering * Check if it's the same drive as the current directory.
49cf4170d0b586551527ebf4297f8a3fe6bd71a3Lennart Poettering int rc = RTPathGetCurrent(pszPath, cbPath);
49cf4170d0b586551527ebf4297f8a3fe6bd71a3Lennart Poettering || RT_C_TO_LOWER(chDrive) == RT_C_TO_LOWER(*pszPath))
49cf4170d0b586551527ebf4297f8a3fe6bd71a3Lennart Poettering * Different drive, indicate root.
49cf4170d0b586551527ebf4297f8a3fe6bd71a3Lennart Poettering * No driver letters, just return root slash on whatever we're asked.
return VERR_BUFFER_OVERFLOW;