Cake: Add File Touch API

Created on 27 Jan 2017  路  6Comments  路  Source: cake-build/cake

I'd like some way to 'touch' (i.e. set the last write time to the current time) a file using cake.

Basically to do this: System.IO.File.SetLastWriteTimeUtc(fileName, DateTime.UtcNow);

Does that sound like something you would consider accepting a PR for, or should I create this as an addin instead? I figured it'd fit well within Cake.Common.IO, following the same pattern as the other basic file operations.

All 6 comments

@Gudahtt I think that this would make sense as an addin. However, I don't think that we should create a new addin, but rather extend an add that already exists, namely:

https://github.com/Redth/Cake.FileHelpers

I think a PR to that repo would make sense.

What do you think @Redth

That sounds like a good idea to me. Will implement Monday unless someone makes a PR before that :)

@Redth I noticed that there was a couple PR's outstanding on that repo as well. Is that something you would be in a position to look at? Or would you like to move that addin into the cake-contrib repo, so that others in the community can help? Thanks!

I'll have a look at those as well.

Great! I hadn't seen that addin before, that's perfect.

@Redth I'll write up a PR this evening.

@Redth _Touch_ usually not only means to update the last modification date, but also creating the file, if it doesn't exist.

Was this page helpful?
0 / 5 - 0 ratings