save a file with exist file name by mistake in Ubuntu - save

I have a .cpp file named "LocalMap.cpp" in my folder in Ubuntu OS 14.04, then I saved another file named "LocalMap.cpp" with gedit in the same folder by mistake. So the last file content missing, and it's not in the Trash.
Is that possible to find the last file?
Thanks for your help.

You just overwritten the old file. Entire content of the last file is replaced with new content. So you just lost the old file content. You cannot recover from the trash folder. Files are moved to trash folder only when you delete the file. In this case you just lost the old file content.

Related

Manually re-compress an unzipped system.iopackage to a working Excel file

System.IO.Packaging is easy to work with because the resulting files are ZIPped folders, so you can simply rename the file to .zip and then open it. I do this with XLSX files to see how they are built.
Unfortunately, the reverse is not true; if you re-compress the folder and rename it .XLSX, Excel with say it has unreadable content. This is true even if the file is unchanged. If you simply rename, extract all, recompress, rename, the resulting file does not work.
Poking about inside, it seems the format of the file is not a canonical zip, header information is missing?
Anyone know an easy trick to recompress these files in Explorer? It would be nice to be able to test changes.

Resizetizer One or more invalid file names were detected

I can't get rid of this build error in my .net maui app in Visual Studio for Mac 2022 v17? The build output says:
/usr/local/share/dotnet/packs/Microsoft.Maui.Resizetizer.Sdk/6.0.300-rc.3.5667/targets/Microsoft.Maui.Resizetizer.targets(511,9): error : One or more invalid file names were detected. File names must be lowercase, start and end with a letter character, and contain only alphanumeric characters or underscores:
When I copied the image files into the resource/image folder they did have invalid characters, but I renamed the files to only have valid lowercase alpha numeric letters but still visual studio is just broken. I've cleaned the project, manually deleted bin and obj folders, restarted the solution and visual studio and even booted the whole machine with no success. I've even tried to delete all images but no luck.
There must be some other cache that is still holding invalid references of the error message is simply wrong and is thrown for some other related reason. Any help finding this issues would be greatly appreciated.
Edit
I have now created a new project (MyMauiSolution) and one by one copied the folders from the old solution to see where it would break. After all files are coped into the new project it still works. So now I have 2 solutions with more or less exactly the same files/images, where one is working and the other is not?!
I have even tried diffing the folder structures, but there are no differences?!
myiMac:Projects user_x$ diff -rq BlueWhaleMaui MyMauiSolution
Files BlueWhaleMaui/.DS_Store and MyMauiSolution/.DS_Store differ
Only in BlueWhaleMaui: .git
Only in BlueWhaleMaui: .gitignore
Only in BlueWhaleMaui: BlueWhaleMaui
Only in MyMauiSolution: MyMauiApp
This is likely caused by the existence of a hidden file in the Resources\Images directory created by the Mac operating system when using the Finder to manipulate files in that directory. (.DS_store)
The .DS_store is not visible in Finder even when 'Show All Files' is turned on, so to confirm:
Open the Terminal application
Change to your project's Resources\Images directory
Perform the command 'ls -la' in the Resources\Images directory
Confirm the existence of the '.DS_store' file (or any other 'dot' file)
There are two solutions (one a workaround, really)
Simply use the Terminal application window to delete the file
Edit your project (csproj) file to exclude the .DS_store from resizing
If you delete the file using terminal the issue will return the next time you use Finder to manipulate files in that folder/directory.
Alternatively, open your project (csproj) file and find the section that defines the MauiImage resources in your project. It should look something like this :<MauiImage Include="Resources\Images\* />
Change that from a single wildcard to a list of more specific patterns to include:
<MauiImage Include="Resources\Images\*svg />
<MauiImage Include="Resources\Images\*png />
<MauiImage Include="Resources\Images\*jpg />
This should include only files ending in these image-type file extensions in the resizing process and skipping the .DS_store file.
I had the same problem. As a workaround I deleted 'Images' folder (after backed up), create a new 'Images' folder and restore the images.

Xcode .gitignore files within directories

I am looking to .gitignore my plist file found within a subdirectory within my project. When I ignore individual files at the root level where .gitignore is located I have no problems with the exclusion, but when I try to exclude files within the a subdirectory I can't seem set up the proper way to exclude this and my file still appears. I think what is throwing me off the most is the way that my Xcode projects appear in my finder compared to my Xcode program. In Xcode, my .plist appears within a Supporting Files folder. Once would assume that this would mean my gitignore request would be /app-name/Supporting Files/Info.plist, but in the finder, there is no Supporting Files folder, just Info.plist.
Any advice as to what I should do?
Should my .gitignore look like:
facebook-login-template/Info.plist
or
/facebook-login-template/Supporting Files/Info.plist
or should it be something else?
I think you are looking for this:
*Info.plist
If you only want to avoid the one inside "facebook-login-template", it should work with
facebook-login-template/Info.plist
but remember you have to reset the file on git if you've already tracked it.

xcode: missing file xcdatamodeld after changing the path of file

I added a data model to my project and found a bundle users.xcdatamodeld in my project directory. after that I moved under a sub directory of the project. also moved physically. and after that when I compiled, xcode shows missing file error.
Any help on this will be thankful.
Delete the file from the file list in xcode (it should be in red text) then go to add File->Add File to "Project" and add the file back to your project.

Xcode isn't copying the files in my folder

During my build my files arent always copied. Even when i modify them.
Its a web app im building and the folder that isnt copying is:
HTML (blue folder icon) it references a HTML folder on disk.
It doesnt seem to copy.
I've tryed doing a run script saying
Shell: /bin/sh
Script:
touch -cm ${SRCROOT}
And it makes no differnece.
How can i FORCE xcode to always copy every file?
E.g a script to touch every file and folder to make sure it copies?
Im a a dead end here!
A blue folder represents a folder reference, which is a kind of file reference, just like all the references to .h and .m files in your project.
The only modification time Xcode cares about is that of the referenced item—in this case, the folder. Not that of any item in the folder, nor of any descendant item, nor of any ancestor folder (such as your project directory, which is what $SRCROOT refers to).
So, you need to touch the folder specifically. Any time you modify anything in the folder, you need to touch that folder.
This doesn't apply if you add or delete files in the folder, since that counts as modifying the folder itself.
If you really want to unconditionally copy the folder every time, you can create a shell script phase before the Copy Files phase that takes the folder as an input and produces it as an output, and touches that folder specifically. Then the Copy Files phase after it will see that the folder has been “modified” and will re-copy it.
Expect long build times if you do that.

Resources