Browse Source

Make cmake copy webui files to the i2pd data folder.

pull/271/head
EinMByte 9 years ago
parent
commit
6857dcb911
  1. 19
      CMakeLists.txt
  2. 8
      README.md
  3. 1
      build/BUILD_NOTES.md
  4. 12
      core/util/util.cpp
  5. 1
      webui/index.html

19
CMakeLists.txt

@ -11,6 +11,7 @@ option(WITH_UPNP "Include support for UPnP client" OFF) @@ -11,6 +11,7 @@ option(WITH_UPNP "Include support for UPnP client" OFF)
option(WITH_TESTS "Build unit tests" OFF)
option(WITH_BENCHMARK "Build benchmarking code" OFF)
option(WITH_OPTIMIZE "Optimization flags" OFF)
option(I2PD_DATA_PATH "The path to the i2pd data folder")
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake_modules")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
@ -153,6 +154,18 @@ include_directories( @@ -153,6 +154,18 @@ include_directories(
"core/"
)
if(I2PD_DATA_PATH)
set(I2PD_DATA_DIR ${I2PD_DATA_PATH})
# Using custom path, make sure the code knows about this
add_definitions(-DI2PD_CUSTOM_DATA_PATH="${I2PD_DATA_PATH}")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(I2PD_DATA_DIR "$ENV{APPDATA}\i2pd")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(I2PD_DATA_DIR "$ENV{HOME}/Library/Application Support/i2pd")
else()
set(I2PD_DATA_DIR "$ENV{HOME}/.i2pd")
endif()
# Show summary
message(STATUS "---------------------------------------")
message(STATUS "Build type : ${CMAKE_BUILD_TYPE}")
@ -160,6 +173,7 @@ message(STATUS "Compiler vendor : ${CMAKE_CXX_COMPILER_ID}") @@ -160,6 +173,7 @@ message(STATUS "Compiler vendor : ${CMAKE_CXX_COMPILER_ID}")
message(STATUS "Compiler version : ${CMAKE_CXX_COMPILER_VERSION}")
message(STATUS "Compiler path : ${CMAKE_CXX_COMPILER}")
message(STATUS "Install prefix: : ${CMAKE_INSTALL_PREFIX}")
message(STATUS "I2PD data directory: ${I2PD_DATA_DIR}")
message(STATUS "Options:")
message(STATUS " AESNI : ${WITH_AESNI}")
message(STATUS " HARDENING : ${WITH_HARDENING}")
@ -183,3 +197,8 @@ add_subdirectory(core) @@ -183,3 +197,8 @@ add_subdirectory(core)
add_subdirectory(client)
add_subdirectory(tests)
add_subdirectory(benchmark)
if(WITH_BINARY)
file(MAKE_DIRECTORY "${I2PD_DATA_DIR}/webui")
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/webui" DESTINATION "${I2PD_DATA_DIR}")
endif()

8
README.md

@ -37,8 +37,8 @@ Build Statuses @@ -37,8 +37,8 @@ Build Statuses
- Microsoft VC13 - To be added
Testing
-------
Building from source
--------------------
First, build it.
@ -58,6 +58,10 @@ By default, the web console is located at http://localhost:7070/. @@ -58,6 +58,10 @@ By default, the web console is located at http://localhost:7070/.
For a list of cmake options, see build/BUILD_NOTES.md
Note that cmake will automatically create a directory for storing configuration files.
To change the location of this directory, you must set the I2PD_DATA_DIR flag.
This does not apply to core-only builds.
Building Unit Tests
-------------------

1
build/BUILD_NOTES.md

@ -9,6 +9,7 @@ Available cmake options: @@ -9,6 +9,7 @@ Available cmake options:
* WITH_TESTS -- build tests (ON/OFF)
* WITH_BENCHMARK -- build bechmarking code (ON/OFF)
* WITH_OPTIMIZE -- enable optimization flags (ON/OFF) (not for MSVC)
* I2PD_DATA_DIR -- directory where i2pd will store data
Debian
------

12
core/util/util.cpp

@ -195,23 +195,24 @@ namespace filesystem @@ -195,23 +195,24 @@ namespace filesystem
boost::filesystem::path GetDefaultDataDir()
{
// Custom path, or default path:
// Windows < Vista: C:\Documents and Settings\Username\Application Data\i2pd
// Windows >= Vista: C:\Users\Username\AppData\Roaming\i2pd
// Mac: ~/Library/Application Support/i2pd
// Unix: ~/.i2pd or /var/lib/i2pd is system=1
// Unix: ~/.i2pd
#ifdef I2PD_CUSTOM_DATA_PATH
return boost::filesystem::path(std::string(I2PD_CUSTOM_DATA_PATH));
#else
#ifdef WIN32
// Windows
char localAppData[MAX_PATH];
SHGetFolderPath(NULL, CSIDL_APPDATA, 0, NULL, localAppData);
return boost::filesystem::path(std::string(localAppData) + "\\" + appName);
#else
if(i2p::util::config::GetArg("-service", 0)) // use system folder
return boost::filesystem::path(std::string ("/var/lib/") + appName);
boost::filesystem::path pathRet;
char* pszHome = getenv("HOME");
if(pszHome == NULL || strlen(pszHome) == 0)
pathRet = boost::filesystem::path("/");
pathRet = boost::filesystem::path("/");
else
pathRet = boost::filesystem::path(pszHome);
#ifdef MAC_OSX
@ -223,6 +224,7 @@ namespace filesystem @@ -223,6 +224,7 @@ namespace filesystem
// Unix
return pathRet / (std::string (".") + appName);
#endif
#endif
#endif
}

1
webui/index.html

@ -0,0 +1 @@ @@ -0,0 +1 @@
Nothing here yet.
Loading…
Cancel
Save