2016-12-23 13:21:01 +00:00
|
|
|
@echo off
|
|
|
|
setlocal enabledelayedexpansion
|
|
|
|
set "FullScriptPath=%~dp0"
|
|
|
|
set "FullExecPath=%cd%"
|
|
|
|
|
|
|
|
set "Command=%1"
|
2017-08-30 17:36:12 +00:00
|
|
|
if "%Command%" == "test" (
|
|
|
|
call :write_test %2
|
|
|
|
exit /b %errorlevel%
|
|
|
|
) else if "%Command%" == "header" (
|
2016-12-23 13:21:01 +00:00
|
|
|
call :write_header %2
|
|
|
|
exit /b %errorlevel%
|
|
|
|
) else if "%Command%" == "source" (
|
|
|
|
call :write_source %2
|
|
|
|
exit /b %errorlevel%
|
2017-03-28 12:30:38 +00:00
|
|
|
) else if "%Command%" == "" (
|
|
|
|
echo This is an utility for fast blank module creation.
|
|
|
|
echo Please provide module path.
|
|
|
|
exit /b
|
2016-12-23 13:21:01 +00:00
|
|
|
)
|
|
|
|
|
2017-02-03 20:07:26 +00:00
|
|
|
call :write_module %Command%
|
|
|
|
exit /b %errorlevel%
|
2016-12-23 13:21:01 +00:00
|
|
|
|
|
|
|
:write_module
|
|
|
|
(
|
|
|
|
set "CommandPath=%1"
|
|
|
|
set "CommandPathUnix=!CommandPath:\=/!"
|
|
|
|
if "!CommandPathUnix!" == "" (
|
|
|
|
echo Provide module path.
|
|
|
|
exit /b 1
|
|
|
|
)
|
|
|
|
echo Generating module !CommandPathUnix!..
|
2017-02-03 20:07:26 +00:00
|
|
|
call create.bat header !CommandPathUnix!
|
|
|
|
call create.bat source !CommandPathUnix!
|
2016-12-23 13:21:01 +00:00
|
|
|
exit /b
|
|
|
|
)
|
|
|
|
|
|
|
|
:write_header
|
|
|
|
(
|
|
|
|
set "CommandPath=%1"
|
|
|
|
set "CommandPathUnix=!CommandPath:\=/!"
|
|
|
|
set "CommandPathWin=!CommandPath:/=\!"
|
|
|
|
|
|
|
|
if "!CommandPathUnix!" == "" (
|
|
|
|
echo Provide header path.
|
|
|
|
exit /b 1
|
|
|
|
) else if exist "SourceFiles\!CommandPathWin!.h" (
|
|
|
|
echo This header already exists.
|
|
|
|
exit /b 1
|
|
|
|
)
|
|
|
|
echo Generating header !CommandPathUnix!.h..
|
|
|
|
mkdir "SourceFiles\!CommandPathWin!.h"
|
|
|
|
rmdir "SourceFiles\!CommandPathWin!.h"
|
|
|
|
|
|
|
|
call :write_comment !CommandPathWin!.h
|
|
|
|
set "header1=#pragma once"
|
|
|
|
(
|
|
|
|
echo !header1!
|
|
|
|
echo.
|
|
|
|
)>> "SourceFiles\!CommandPathWin!.h"
|
|
|
|
exit /b
|
|
|
|
)
|
|
|
|
|
|
|
|
:write_source
|
|
|
|
(
|
|
|
|
set "CommandPath=%1"
|
|
|
|
set "CommandPathUnix=!CommandPath:\=/!"
|
|
|
|
set "CommandPathWin=!CommandPath:/=\!"
|
|
|
|
|
|
|
|
if "!CommandPathUnix!" == "" (
|
|
|
|
echo Provide source path.
|
|
|
|
exit /b 1
|
|
|
|
) else if exist "SourceFiles\!CommandPathWin!.cpp" (
|
|
|
|
echo This source already exists.
|
|
|
|
exit /b 1
|
|
|
|
)
|
|
|
|
echo Generating source !CommandPathUnix!.cpp..
|
|
|
|
mkdir "SourceFiles\!CommandPathWin!.cpp"
|
|
|
|
rmdir "SourceFiles\!CommandPathWin!.cpp"
|
|
|
|
|
|
|
|
call :write_comment !CommandPathWin!.cpp
|
|
|
|
set "quote="""
|
|
|
|
set "quote=!quote:~0,1!"
|
2017-03-04 09:27:52 +00:00
|
|
|
set "source1=#include !quote!!CommandPathUnix!.h!quote!"
|
2016-12-23 13:21:01 +00:00
|
|
|
(
|
|
|
|
echo !source1!
|
|
|
|
echo.
|
|
|
|
)>> "SourceFiles\!CommandPathWin!.cpp"
|
|
|
|
exit /b
|
|
|
|
)
|
|
|
|
|
2017-08-30 17:36:12 +00:00
|
|
|
:write_test
|
|
|
|
(
|
|
|
|
set "CommandPath=%1"
|
|
|
|
set "CommandPathUnix=!CommandPath:\=/!"
|
|
|
|
set "CommandPathWin=!CommandPath:/=\!"
|
|
|
|
|
|
|
|
if "!CommandPathUnix!" == "" (
|
|
|
|
echo Provide source path.
|
|
|
|
exit /b 1
|
|
|
|
) else if exist "SourceFiles\!CommandPathWin!.cpp" (
|
|
|
|
echo This source already exists.
|
|
|
|
exit /b 1
|
|
|
|
)
|
|
|
|
echo Generating test !CommandPathUnix!.cpp..
|
|
|
|
mkdir "SourceFiles\!CommandPathWin!.cpp"
|
|
|
|
rmdir "SourceFiles\!CommandPathWin!.cpp"
|
|
|
|
|
|
|
|
call :write_comment !CommandPathWin!.cpp
|
|
|
|
set "quote="""
|
|
|
|
set "quote=!quote:~0,1!"
|
|
|
|
set "source1=#include !quote!catch.hpp!quote!"
|
|
|
|
(
|
|
|
|
echo !source1!
|
|
|
|
echo.
|
|
|
|
)>> "SourceFiles\!CommandPathWin!.cpp"
|
|
|
|
exit /b
|
|
|
|
)
|
|
|
|
|
2016-12-23 13:21:01 +00:00
|
|
|
:write_comment
|
|
|
|
(
|
|
|
|
set "Path=%1"
|
|
|
|
(
|
|
|
|
echo /*
|
|
|
|
echo This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
echo the official desktop application for the Telegram messaging service.
|
2016-12-23 13:21:01 +00:00
|
|
|
echo.
|
2018-01-03 10:23:14 +00:00
|
|
|
echo For license and copyright information please follow this link:
|
|
|
|
echo https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2016-12-23 13:21:01 +00:00
|
|
|
echo */
|
|
|
|
)> "SourceFiles\!Path!"
|
|
|
|
exit /b
|
|
|
|
)
|