From: Mathnerd314 Date: Sat, 13 Jun 2009 20:31:24 +0000 (+0000) Subject: * remove unused libvorbisenc from FindOggVorbis and link path X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=216e6b44cf103d10383c0e0f6587afafc7454b94;p=supertux.git * remove unused libvorbisenc from FindOggVorbis and link path * file_system works on Windows-style paths to allow editor to work SVN-Revision: 5894 --- diff --git a/mk/cmake/FindOggVorbis.cmake b/mk/cmake/FindOggVorbis.cmake index d4349acd9..898e7d26a 100644 --- a/mk/cmake/FindOggVorbis.cmake +++ b/mk/cmake/FindOggVorbis.cmake @@ -1,3 +1,6 @@ + +### SuperTux - Removed unused vorbisenc library + # - Try to find the OggVorbis libraries # Once done this will define # @@ -8,22 +11,21 @@ # OGG_LIBRARY - The Ogg library # VORBIS_LIBRARY - The Vorbis library # VORBISFILE_LIBRARY - The VorbisFile library -# VORBISENC_LIBRARY - The VorbisEnc library # Copyright (c) 2006, Richard Laerkaeng, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. + include (CheckLibraryExists) find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h) find_library(OGG_LIBRARY NAMES ogg) find_library(VORBIS_LIBRARY NAMES vorbis) find_library(VORBISFILE_LIBRARY NAMES vorbisfile) -find_library(VORBISENC_LIBRARY NAMES vorbisenc) -if (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY) +if (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY) set(OGGVORBIS_FOUND TRUE) # [sommer] (for SuperTux) reversed order of libraries, so that cmake 2.4.5 for Windows generates an MSYS Makefile that will link correctly -# set(OGGVORBIS_LIBRARIES ${OGG_LIBRARY} ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBISENC_LIBRARY}) - set(OGGVORBIS_LIBRARIES ${VORBISENC_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY}) +# set(OGGVORBIS_LIBRARIES ${OGG_LIBRARY} ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY}) + set(OGGVORBIS_LIBRARIES ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY}) set(_CMAKE_REQUIRED_LIBRARIES_TMP ${CMAKE_REQUIRED_LIBRARIES}) set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${OGGVORBIS_LIBRARIES}) check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2) @@ -33,10 +35,10 @@ if (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_L else (HAVE_LIBVORBISENC2) set (OGGVORBIS_VERSION 1) endif (HAVE_LIBVORBISENC2) -else (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY) +else (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY) set (OGGVORBIS_VERSION) set(OGGVORBIS_FOUND FALSE) -endif (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY) +endif (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY) if (OGGVORBIS_FOUND) if (NOT OggVorbis_FIND_QUIETLY) message(STATUS "Found OggVorbis: ${OGGVORBIS_LIBRARIES}") @@ -53,20 +55,18 @@ endif (OGGVORBIS_FOUND) #check_library_exists(ogg ogg_page_version "" HAVE_LIBOGG) #check_library_exists(vorbis vorbis_info_init "" HAVE_LIBVORBIS) #check_library_exists(vorbisfile ov_open "" HAVE_LIBVORBISFILE) -#check_library_exists(vorbisenc vorbis_info_clear "" HAVE_LIBVORBISENC) #check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2) -#if (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC) +#if (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE) # message(STATUS "Ogg/Vorbis found") # set (VORBIS_LIBS "-lvorbis -logg") # set (VORBISFILE_LIBS "-lvorbisfile") -# set (VORBISENC_LIBS "-lvorbisenc") # set (OGGVORBIS_FOUND TRUE) # if (HAVE_LIBVORBISENC2) # set (HAVE_VORBIS 2) # else (HAVE_LIBVORBISENC2) # set (HAVE_VORBIS 1) # endif (HAVE_LIBVORBISENC2) -#else (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC) +#else (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE) # message(STATUS "Ogg/Vorbis not found") -#endif (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC) +#endif (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE) diff --git a/src/file_system.cpp b/src/file_system.cpp index 447c21e2c..5f5be1d72 100644 --- a/src/file_system.cpp +++ b/src/file_system.cpp @@ -33,6 +33,8 @@ std::string dirname(const std::string& filename) { std::string::size_type p = filename.find_last_of('/'); if(p == std::string::npos) + p = filename.find_last_of('\\'); + if(p == std::string::npos) return ""; return filename.substr(0, p+1); @@ -42,6 +44,8 @@ std::string basename(const std::string& filename) { std::string::size_type p = filename.find_last_of('/'); if(p == std::string::npos) + p = filename.find_last_of('\\'); + if(p == std::string::npos) return filename; return filename.substr(p+1, filename.size()-p-1); @@ -63,13 +67,13 @@ std::string normalize(const std::string& filename) const char* p = filename.c_str(); while(true) { - while(*p == '/') { + while(*p == '/' || *p == '\\') { p++; continue; } const char* pstart = p; - while(*p != '/' && *p != 0) { + while(*p != '/' && *p != '\\' && *p != 0) { ++p; }