File tree Expand file tree Collapse file tree
Tocsoft.GraphQLCodeGen.MsBuild Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -103,21 +103,22 @@ public override bool Execute()
103103 string fileName = Path . GetFileName ( f ) ;
104104 string newFileContent = File . ReadAllText ( f ) ;
105105 string hashFile = Path . Combine ( fullIntermediateOutputDirectory , fileName + ".hash" ) ;
106+ string targetPath = Path . Combine ( fullIntermediateOutputDirectory , fileName ) ;
107+
106108 bool filedirty = true ;
107109 string actualHash = GetSha256Hash ( sha , newFileContent ) ; // TODO skip section while hashing (generated date etc)
108- if ( File . Exists ( hashFile ) )
110+ if ( File . Exists ( hashFile ) && File . Exists ( targetPath ) ) // ensure we only try and skip if files exist on disk
109111 {
110112 string hash = File . ReadAllText ( hashFile ) ;
111113 filedirty = hash != actualHash ;
112114 }
113- File . WriteAllText ( hashFile , actualHash ) ;
114115
115- string targetPAth = Path . Combine ( fullIntermediateOutputDirectory , fileName ) ;
116116 if ( filedirty )
117117 {
118- File . WriteAllText ( targetPAth , newFileContent ) ;
118+ File . WriteAllText ( hashFile , actualHash ) ;
119+ File . WriteAllText ( targetPath , newFileContent ) ;
119120 }
120- generateFiles . Add ( new TaskItem ( targetPAth ) ) ;
121+ generateFiles . Add ( new TaskItem ( targetPath ) ) ;
121122 }
122123 // find matching files in this folder if they have identical hashes then skip them
123124
You can’t perform that action at this time.
0 commit comments