separate out is_pathsep

This commit is contained in:
David Rose 2009-07-07 14:58:10 +00:00
parent 09d7fb02d8
commit 8a9358adb3
5 changed files with 59 additions and 38 deletions

View File

@ -98,6 +98,7 @@
load_plugin.cxx load_plugin.h \
fileSpec.cxx fileSpec.h fileSpec.I \
find_root_dir.cxx find_root_dir.h \
is_pathsep.h is_pathsep.I \
mkdir_complete.cxx mkdir_complete.h
#end static_lib_target

View File

@ -0,0 +1,33 @@
// Filename: is_pathsep.I
// Created by: drose (07Jul09)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
// Function: is_pathsep
// Description: Returns true if the indicated character is a path
// separator character (e.g. slash or backslash), false
// otherwise.
////////////////////////////////////////////////////////////////////
inline bool
is_pathsep(char ch) {
if (ch == '/') {
return true;
}
#ifdef _WIN32
if (ch == '\\') {
return true;
}
#endif
return false;
}

View File

@ -0,0 +1,23 @@
// Filename: is_pathsep.h
// Created by: drose (07Jul09)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#ifndef IS_PATHSEP_H
#define IS_PATHSEP_H
inline bool
is_pathsep(char ch);
#include "is_pathsep.I"
#endif

View File

@ -14,6 +14,7 @@
#include "load_plugin.h"
#include "p3d_plugin_config.h"
#include "is_pathsep.h"
#include "assert.h"
@ -74,25 +75,6 @@ get_plugin_basename() {
return default_plugin_filename + dll_ext;
}
////////////////////////////////////////////////////////////////////
// Function: is_pathsep
// Description: Returns true if the indicated character is a path
// separator character (e.g. slash or backslash), false
// otherwise.
////////////////////////////////////////////////////////////////////
static inline bool
is_pathsep(char ch) {
if (ch == '/') {
return true;
}
#ifdef _WIN32
if (ch == '\\') {
return true;
}
#endif
return false;
}
////////////////////////////////////////////////////////////////////
// Function: find_extension_dot
// Description: Returns the position in the string of the dot before

View File

@ -13,6 +13,7 @@
////////////////////////////////////////////////////////////////////
#include "mkdir_complete.h"
#include "is_pathsep.h"
#ifdef _WIN32
#include <windows.h>
@ -24,25 +25,6 @@
////////////////////////////////////////////////////////////////////
// Function: is_pathsep
// Description: Returns true if the indicated character is a path
// separator character (e.g. slash or backslash), false
// otherwise.
////////////////////////////////////////////////////////////////////
static inline bool
is_pathsep(char ch) {
if (ch == '/') {
return true;
}
#ifdef _WIN32
if (ch == '\\') {
return true;
}
#endif
return false;
}
////////////////////////////////////////////////////////////////////
// Function: get_dirname
// Description: Returns the directory component of the indicated