| [3244] | 1 | /**************************************************************************** |
|---|
| 2 | |
|---|
| 3 | Copyright 2007, Virginia Polytechnic Institute and State University |
|---|
| 4 | |
|---|
| 5 | This file is part of the OSSIE Core Framework. |
|---|
| 6 | |
|---|
| 7 | OSSIE Core Framework is free software; you can redistribute it and/or modify |
|---|
| 8 | it under the terms of the Lesser GNU General Public License as published by |
|---|
| 9 | the Free Software Foundation; either version 2.1 of the License, or |
|---|
| 10 | (at your option) any later version. |
|---|
| 11 | |
|---|
| 12 | OSSIE Core Framework is distributed in the hope that it will be useful, |
|---|
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | Lesser GNU General Public License for more details. |
|---|
| 16 | |
|---|
| 17 | You should have received a copy of the Lesser GNU General Public License |
|---|
| 18 | along with OSSIE Core Framework; if not, write to the Free Software |
|---|
| 19 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 20 | |
|---|
| 21 | ****************************************************************************/ |
|---|
| 22 | |
|---|
| 23 | #include <string> |
|---|
| 24 | |
|---|
| [3264] | 25 | #include <boost/filesystem/path.hpp> |
|---|
| 26 | |
|---|
| [3538] | 27 | namespace fs = boost::filesystem; |
|---|
| 28 | |
|---|
| [3244] | 29 | #include <ossie/ossieSupport.h> |
|---|
| 30 | |
|---|
| 31 | void ossieSupport::createProfileFromFileName(std::string fileName, std::string &profile) |
|---|
| 32 | { |
|---|
| [3368] | 33 | profile = "<profile filename=\"" + fileName + "\" />"; |
|---|
| [3244] | 34 | |
|---|
| 35 | return; |
|---|
| 36 | } |
|---|
| [3264] | 37 | |
|---|
| 38 | bool ossieSupport::isValidFileName(const char *fileName) |
|---|
| 39 | { |
|---|
| [3268] | 40 | try { |
|---|
| [3538] | 41 | fs::path testPath(fileName, fs::portable_posix_name); |
|---|
| [3268] | 42 | } catch (...) { |
|---|
| 43 | return false; |
|---|
| 44 | } |
|---|
| 45 | |
|---|
| 46 | return true; |
|---|
| [3264] | 47 | } |
|---|
| [3538] | 48 | |
|---|
| 49 | const char * ossieSupport::spd_rel_file(const char *spdFile, const char *name, std::string &fileName) |
|---|
| 50 | { |
|---|
| 51 | |
|---|
| 52 | fs::path spdPath(spdFile); |
|---|
| 53 | |
|---|
| 54 | fs::path filePath = spdPath.branch_path() / name; |
|---|
| 55 | |
|---|
| 56 | fileName = filePath.string(); |
|---|
| 57 | |
|---|
| 58 | return fileName.c_str(); |
|---|
| 59 | } |
|---|