mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
Add script to remove annoying IDE-inserted ExplicitTop/Left/Height/Width properties
This commit is contained in:
8
extra/remove-explicit.cmd
Normal file
8
extra/remove-explicit.cmd
Normal file
@@ -0,0 +1,8 @@
|
||||
@echo off
|
||||
|
||||
rem ensure current directory is where this file lives
|
||||
set olddir=%CD%
|
||||
cd %~dp0
|
||||
php remove-explicit.php ..\source\
|
||||
cd %olddir%
|
||||
pause
|
||||
28
extra/remove-explicit.php
Normal file
28
extra/remove-explicit.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
if($argc < 2) {
|
||||
die("Usage:\n ".$argv[0]." path\\to\dfmfiles\n");
|
||||
}
|
||||
|
||||
$path = $argv[1];
|
||||
if(!is_dir($path)) {
|
||||
die("Error: \"".$path."\" is not a valid directory.\n");
|
||||
}
|
||||
|
||||
$files = glob($path.'\\*.dfm');
|
||||
#var_dump($files);
|
||||
$replaceCountAll = $touchedFileCount = 0;
|
||||
foreach($files as $file) {
|
||||
$fileTime = filemtime($file);
|
||||
$dfm = file_get_contents($file);
|
||||
$replaceCount = 0;
|
||||
$dfm = preg_replace('# *Explicit\w+\s+\=\s+\d+\r\n#i', '\\1', $dfm, -1, $replaceCount);
|
||||
if($replaceCount > 0) {
|
||||
$replaceCountAll += $replaceCount;
|
||||
$touchedFileCount++;
|
||||
file_put_contents($file, $dfm);
|
||||
touch($file, $fileTime);
|
||||
}
|
||||
}
|
||||
|
||||
echo $replaceCountAll." lines from ".$touchedFileCount." files removed\n";
|
||||
Reference in New Issue
Block a user