/****************************************************************************

Copyright 2007, Virginia Polytechnic Institute and State University

This file is part of the OSSIE Core Framework.

OSSIE Core Framework is free software; you can redistribute it and/or modify
it under the terms of the Lesser GNU General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

OSSIE Core Framework is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Lesser GNU General Public License for more details.

You should have received a copy of the Lesser GNU General Public License
along with OSSIE Core Framework; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

****************************************************************************/

#include <string>

#include <boost/filesystem/path.hpp>

namespace fs = boost::filesystem;

#include <ossie/ossieSupport.h>

void ossieSupport::createProfileFromFileName(std::string fileName, std::string &profile)
{
    profile = "<profile filename=\"" + fileName + "\" />";

    return;
}

bool ossieSupport::isValidFileName(const char *fileName)
{
    try {
	fs::path testPath(fileName, fs::portable_posix_name);
    } catch (...) {
	return false;
    }

    return true;
}

const char * ossieSupport::spd_rel_file(const char *spdFile, const char *name, std::string &fileName)
{

    fs::path spdPath(spdFile);

    fs::path filePath = spdPath.branch_path() / name;

    fileName = filePath.string();

    return fileName.c_str();
}
