diff options
Diffstat (limited to 'src/TemplateBatchScript.cpp')
-rw-r--r--[-rwxr-xr-x] | src/TemplateBatchScript.cpp | 166 |
1 files changed, 83 insertions, 83 deletions
diff --git a/src/TemplateBatchScript.cpp b/src/TemplateBatchScript.cpp index d34681b..0650cb4 100755..100644 --- a/src/TemplateBatchScript.cpp +++ b/src/TemplateBatchScript.cpp @@ -33,95 +33,95 @@ "__INDENTERCALLSTRING2__" the call string for indenting only one file. And "__INDENTERCALLSTRINGSCRIPTNAME__" which is only the shown name of the indenter. */ -const char* TemplateBatchScript::getTemplateBatchScript() { - static const char* templateBatchScript = -#if defined(Q_OS_WIN32) - "@echo off\n" - "\n" - "IF (%1)==() GOTO error\n" - "dir /b /ad %1 >nul 2>nul && GOTO indentDir\n" - "IF NOT EXIST %1 GOTO error\n" - "goto indentFile\n" - "\n" - ":indentDir\n" - "set searchdir=%1\n" - "\n" - "IF (%2)==() GOTO assignDefaultSuffix\n" - "set filesuffix=%2\n" - "\n" - "GOTO run\n" - "\n" - ":assignDefaultSuffix\n" - "::echo !!!!DEFAULT SUFFIX!!!\n" - "set filesuffix=*\n" - "\n" - ":run\n" - "FOR /F \"tokens=*\" %%G IN ('DIR /B /S %searchdir%\\*.%filesuffix%') DO (\n" - "echo Indenting file \"%%G\"\n" - "__INDENTERCALLSTRING1__\n" - ")\n" - "GOTO ende\n" - "\n" - ":indentFile\n" - "echo Indenting one file %1\n" - "__INDENTERCALLSTRING2__\n" - "\n" - "GOTO ende\n" - "\n" - ":error\n" - "echo .\n" - "echo ERROR: As parameter given directory or file does not exist!\n" - "echo Syntax is: __INDENTERCALLSTRINGSCRIPTNAME__ dirname filesuffix\n" - "echo Syntax is: __INDENTERCALLSTRINGSCRIPTNAME__ filename\n" - "echo Example: __INDENTERCALLSTRINGSCRIPTNAME__ temp cpp\n" - "echo .\n" - "\n" - ":ende\n"; +const char* TemplateBatchScript::getTemplateBatchScript() +{ + static const char *templateBatchScript = +#if defined (Q_OS_WIN32) + "@echo off\n" + "\n" + "IF (%1)==() GOTO error\n" + "dir /b /ad %1 >nul 2>nul && GOTO indentDir\n" + "IF NOT EXIST %1 GOTO error\n" + "goto indentFile\n" + "\n" + ":indentDir\n" + "set searchdir=%1\n" + "\n" + "IF (%2)==() GOTO assignDefaultSuffix\n" + "set filesuffix=%2\n" + "\n" + "GOTO run\n" + "\n" + ":assignDefaultSuffix\n" + "::echo !!!!DEFAULT SUFFIX!!!\n" + "set filesuffix=*\n" + "\n" + ":run\n" + "FOR /F \"tokens=*\" %%G IN ('DIR /B /S %searchdir%\\*.%filesuffix%') DO (\n" + "echo Indenting file \"%%G\"\n" + "__INDENTERCALLSTRING1__\n" + ")\n" + "GOTO ende\n" + "\n" + ":indentFile\n" + "echo Indenting one file %1\n" + "__INDENTERCALLSTRING2__\n" + "\n" + "GOTO ende\n" + "\n" + ":error\n" + "echo .\n" + "echo ERROR: As parameter given directory or file does not exist!\n" + "echo Syntax is: __INDENTERCALLSTRINGSCRIPTNAME__ dirname filesuffix\n" + "echo Syntax is: __INDENTERCALLSTRINGSCRIPTNAME__ filename\n" + "echo Example: __INDENTERCALLSTRINGSCRIPTNAME__ temp cpp\n" + "echo .\n" + "\n" + ":ende\n"; #else - "#!/bin/sh \n" - "\n" - "if [ ! -n \"$1\" ]; then\n" - "echo \"Syntax is: recurse.sh dirname filesuffix\"\n" - "echo \"Syntax is: recurse.sh filename\"\n" - "echo \"Example: recurse.sh temp cpp\"\n" - "exit 1\n" - "fi\n" - "\n" - "if [ -d \"$1\" ]; then\n" - "#echo \"Dir ${1} exists\"\n" - "if [ -n \"$2\" ]; then\n" - "filesuffix=$2\n" - "else\n" - "filesuffix=\"*\"\n" - "fi\n" - "\n" - "#echo \"Filtering files using suffix ${filesuffix}\"\n" - "\n" - "file_list=`find ${1} -name \"*.${filesuffix}\" -type f`\n" - "for file2indent in $file_list\n" - "do \n" - "echo \"Indenting file $file2indent\"\n" - "__INDENTERCALLSTRING1__\n" - "done\n" - "else\n" - "if [ -f \"$1\" ]; then\n" - "echo \"Indenting one file $1\"\n" - "__INDENTERCALLSTRING2__\n" - "else\n" - "echo \"ERROR: As parameter given directory or file does not exist!\"\n" - "echo \"Syntax is: __INDENTERCALLSTRINGSCRIPTNAME__ dirname filesuffix\"\n" - "echo \"Syntax is: __INDENTERCALLSTRINGSCRIPTNAME__ filename\"\n" - "echo \"Example: __INDENTERCALLSTRINGSCRIPTNAME__ temp cpp\"\n" - "exit 1\n" - "fi\n" - "fi\n"; + "#!/bin/sh \n" + "\n" + "if [ ! -n \"$1\" ]; then\n" + "echo \"Syntax is: recurse.sh dirname filesuffix\"\n" + "echo \"Syntax is: recurse.sh filename\"\n" + "echo \"Example: recurse.sh temp cpp\"\n" + "exit 1\n" + "fi\n" + "\n" + "if [ -d \"$1\" ]; then\n" + "#echo \"Dir ${1} exists\"\n" + "if [ -n \"$2\" ]; then\n" + "filesuffix=$2\n" + "else\n" + "filesuffix=\"*\"\n" + "fi\n" + "\n" + "#echo \"Filtering files using suffix ${filesuffix}\"\n" + "\n" + "file_list=`find ${1} -name \"*.${filesuffix}\" -type f`\n" + "for file2indent in $file_list\n" + "do \n" + "echo \"Indenting file $file2indent\"\n" + "__INDENTERCALLSTRING1__\n" + "done\n" + "else\n" + "if [ -f \"$1\" ]; then\n" + "echo \"Indenting one file $1\"\n" + "__INDENTERCALLSTRING2__\n" + "else\n" + "echo \"ERROR: As parameter given directory or file does not exist!\"\n" + "echo \"Syntax is: __INDENTERCALLSTRINGSCRIPTNAME__ dirname filesuffix\"\n" + "echo \"Syntax is: __INDENTERCALLSTRINGSCRIPTNAME__ filename\"\n" + "echo \"Example: __INDENTERCALLSTRINGSCRIPTNAME__ temp cpp\"\n" + "exit 1\n" + "fi\n" + "fi\n"; #endif // #if defined(Q_OS_WIN32) - return templateBatchScript; + return templateBatchScript; } - /* Here comes the original batch script without the c++ markup @echo off |