File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,8 +53,24 @@ public DependencyManager(string srcDir, ILogger logger)
5353 var startTime = DateTime . Now ;
5454
5555 this . logger = logger ;
56+
57+ var diagDirEnv = Environment . GetEnvironmentVariable ( EnvironmentVariableNames . DiagnosticDir ) ;
58+ if ( ! string . IsNullOrWhiteSpace ( diagDirEnv ) &&
59+ ! Directory . Exists ( diagDirEnv ) )
60+ {
61+ try
62+ {
63+ Directory . CreateDirectory ( diagDirEnv ) ;
64+ }
65+ catch ( Exception e )
66+ {
67+ logger . LogError ( $ "Failed to create diagnostic directory { diagDirEnv } : { e . Message } ") ;
68+ diagDirEnv = null ;
69+ }
70+ }
71+
5672 this . diagnosticsWriter = new DiagnosticsStream ( Path . Combine (
57- Environment . GetEnvironmentVariable ( EnvironmentVariableNames . DiagnosticDir ) ?? "" ,
73+ diagDirEnv ?? "" ,
5874 $ "dependency-manager-{ DateTime . UtcNow : yyyyMMddHHmm} -{ Environment . ProcessId } .jsonc") ) ;
5975 this . sourceDir = new DirectoryInfo ( srcDir ) ;
6076
You can’t perform that action at this time.
0 commit comments