File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -53,8 +53,24 @@ public DependencyManager(string srcDir, ILogger logger)
53
53
var startTime = DateTime . Now ;
54
54
55
55
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
+
56
72
this . diagnosticsWriter = new DiagnosticsStream ( Path . Combine (
57
- Environment . GetEnvironmentVariable ( EnvironmentVariableNames . DiagnosticDir ) ?? "" ,
73
+ diagDirEnv ?? "" ,
58
74
$ "dependency-manager-{ DateTime . UtcNow : yyyyMMddHHmm} -{ Environment . ProcessId } .jsonc") ) ;
59
75
this . sourceDir = new DirectoryInfo ( srcDir ) ;
60
76
You can’t perform that action at this time.
0 commit comments