From 8a9358adb30fc6013f14dc230982951e02eca830 Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 7 Jul 2009 14:58:10 +0000 Subject: [PATCH] separate out is_pathsep --- direct/src/plugin/Sources.pp | 1 + direct/src/plugin/is_pathsep.I | 33 ++++++++++++++++++++++++++++ direct/src/plugin/is_pathsep.h | 23 +++++++++++++++++++ direct/src/plugin/load_plugin.cxx | 20 +---------------- direct/src/plugin/mkdir_complete.cxx | 20 +---------------- 5 files changed, 59 insertions(+), 38 deletions(-) create mode 100644 direct/src/plugin/is_pathsep.I create mode 100644 direct/src/plugin/is_pathsep.h diff --git a/direct/src/plugin/Sources.pp b/direct/src/plugin/Sources.pp index 7bbe211eef..8f328de93f 100644 --- a/direct/src/plugin/Sources.pp +++ b/direct/src/plugin/Sources.pp @@ -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 diff --git a/direct/src/plugin/is_pathsep.I b/direct/src/plugin/is_pathsep.I new file mode 100644 index 0000000000..5c54341cdf --- /dev/null +++ b/direct/src/plugin/is_pathsep.I @@ -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; +} diff --git a/direct/src/plugin/is_pathsep.h b/direct/src/plugin/is_pathsep.h new file mode 100644 index 0000000000..6308c3383e --- /dev/null +++ b/direct/src/plugin/is_pathsep.h @@ -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 diff --git a/direct/src/plugin/load_plugin.cxx b/direct/src/plugin/load_plugin.cxx index ab14b52ce9..a2cc43caa1 100755 --- a/direct/src/plugin/load_plugin.cxx +++ b/direct/src/plugin/load_plugin.cxx @@ -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 diff --git a/direct/src/plugin/mkdir_complete.cxx b/direct/src/plugin/mkdir_complete.cxx index 88ccd00715..d0aac7ea27 100755 --- a/direct/src/plugin/mkdir_complete.cxx +++ b/direct/src/plugin/mkdir_complete.cxx @@ -13,6 +13,7 @@ //////////////////////////////////////////////////////////////////// #include "mkdir_complete.h" +#include "is_pathsep.h" #ifdef _WIN32 #include @@ -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