AutoCAD version changes working directory, as I see...
AutoCAD 2009-2015 don't do this.
My BAT and
SCR files use
relative paths into own code, therefore now (in AutoCAD 2016) they can't find necessary resources: scr, arg and dwg files, because working directory now is not the same where BAT-file is located.
I can't use absolute paths because often I use
remote machines (i.e. the output paths are not the local directories). If I try to calculate a full path, then it will have somethin like that:
\\CompName\DirName\etc. I can't write such paths into my BAT abd SCR files, because they are located on the remote machine and don't know such paths.
For example, it works fine for AutoCAD 2015:
call "C:\Program Files\Autodesk\AutoCAD 2015\accoreconsole.exe" /s "..\NUnit\startup-2015.scr" /p "..\NUnit\acad_2015_and_newer_NUnit_testing_profile.arg"
But for AutoCAD 2016 it doesn't work:
call "C:\Program Files\Autodesk\AutoCAD 2016\accoreconsole.exe" /s "..\NUnit\startup-2016.scr" /p "..\NUnit\acad_2015_and_newer_NUnit_testing_profile.arg"
AutoCAD 2016 output:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\developer>cd C:\public\Debug\extensions\acad-extensions\ExtensionSample
.UnitTests\run-tests
C:\public\Debug\extensions\acad-extensions\ExtensionSample.UnitTests\run-tests>r
un-tests-in-autocad-2016-NUnit.bat
C:\public\Debug\extensions\acad-extensions\ExtensionSample.UnitTests\run-tests>c
all "C:\Program Files\Autodesk\AutoCAD 2016\accoreconsole.exe" /s "..\NUnit\star
tup-2016.scr" /p "..\NUnit\acad_2015_and_newer_NUnit_testing_profile.arg"
Redirect stdout (file: C:\Users\DEVELO~1\AppData\Local\Temp\accc8722).
AutoCAD Core Engine Console - Copyright Autodesk, Inc 2009-2013.
Regenerating model.
Command:
Command:
"startup-2016.scr": Can't find file.
Command:
Command: _quit
Command:
C:\public\Debug\extensions\acad-extensions\ExtensionSample.UnitTests\run-tests>
Thus my unit tests work fine for AutoCAD 2009-2015, but don't work for AutoCAD 2016.
I can get current directory of the BAT file:
%~dp0, but what about the SCR-file (its code loads a managed DLL with the unit tests)? My BAT and SCR files are generated by msbuild.
Anybody has an idea for fixing of this?