RTPathAbsExDup.cpp revision c58f1213e628a545081c70e26c6b67a841cff880
2N/A/* $Id$ */
2N/A/** @file
2N/A * IPRT - RTPathAbsExDup
2N/A */
2N/A
2N/A/*
2N/A * Copyright (C) 2006-2012 Oracle Corporation
2N/A *
2N/A * This file is part of VirtualBox Open Source Edition (OSE), as
2N/A * available from http://www.virtualbox.org. This file is free software;
2N/A * you can redistribute it and/or modify it under the terms of the GNU
2N/A * General Public License (GPL) as published by the Free Software
2N/A * Foundation, in version 2 as it comes in the "COPYING" file of the
2N/A * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
2N/A * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
2N/A *
2N/A * The contents of this file may alternatively be used under the terms
2N/A * of the Common Development and Distribution License Version 1.0
2N/A * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
2N/A * VirtualBox OSE distribution, in which case the provisions of the
2N/A * CDDL are applicable instead of those of the GPL.
2N/A *
2N/A * You may elect to license modified versions of this file under the
2N/A * terms and conditions of either the GPL or the CDDL or both.
2N/A */
2N/A
2N/A
2N/A/*******************************************************************************
2N/A* Header Files *
2N/A*******************************************************************************/
2N/A#include "internal/iprt.h"
2N/A#include <iprt/path.h>
2N/A#include <iprt/err.h>
2N/A#include <iprt/param.h>
2N/A#include <iprt/string.h>
2N/A
2N/A
2N/A
2N/A/**
2N/A * Same as RTPathAbsEx only the result is RTStrDup()'ed.
2N/A *
2N/A * @returns Pointer to the absolute path. Use RTStrFree() to free this string.
2N/A * @returns NULL if RTPathAbsEx() or RTStrDup() fails.
2N/A * @param pszBase The base path to act like a current directory.
2N/A * When NULL, the actual cwd is used (i.e. the call
2N/A * is equivalent to RTPathAbs(pszPath, ...).
2N/A * @param pszPath The path to resolve.
2N/A */
2N/ARTDECL(char *) RTPathAbsExDup(const char *pszBase, const char *pszPath)
2N/A{
2N/A char szPath[RTPATH_MAX];
2N/A int rc = RTPathAbsEx(pszBase, pszPath, szPath, sizeof(szPath));
2N/A if (RT_SUCCESS(rc))
2N/A return RTStrDup(szPath);
2N/A return NULL;
2N/A}
2N/A
2N/A