Results 1 to 8 of 8

Thread: VB6 GitHub Linebreak Repair

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    6,712

    VB6 GitHub Linebreak Repair


    I've been downloading a lot of VB6 projects from GitHub to test in twinBASIC. When these have been uploaded with certain settings, GitHub replaces the vbCrLf line breaks with vbLf only, which results in a corrupt file that VB6 can't read. tB can-- but I need to confirm working in VB6 first. So I made this small project to automatically repair the line breaks of all VB6 files in a given directory, with a number of options to help. The file type list is preset, but you could change it to work on any file type instead.

    This project uses my tbShellLib project for all the APIs (this is why the source file size is so large; however the compiled exe uses only what is neccessary, so is only 2MB). Can be compiled to both 32bit and 64bit. I've tested to confirm the output is byte for byte identical to using WinHex to manually replace 0x0A with 0x0D 0x0A, and the app checks whether the line breaks already appear to be correct.

    I've gotta say, I use to always put my APIs locally, copying them into each project. But I'm *really* starting to like having 99%+ of the Windows APIs on tap and programming like I'm in C++ with #include <Windows.h>. tbShellLib is up to like 5,500 APIs now (not counting the A/W variants).

    Written in twinBASIC, but trivially simple to convert to VB6 if you must... the Utility Bank doesn't seem to be language-specific. The repository also has builds.

    https://github.com/fafalone/LinebreakRepair

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    12,034

    Re: VB6 GitHub Linebreak Repair

    If you're using GitHub, presumably that means you're using Git BASH for version control. If that's the case are you aware that there's a command you can run in BASH to ensure that all files have CRLF line endings in the repository? It is simply just:
    Code:
    git config --global core.autocrlf true
    I had this issue when working on a PHP project between Linux and Windows machines. Any time I would pull down my changes and open it in my editor, my diff was polluted with the line endings changing. Digging around I found the solution above and it has done me well ever since.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  3. #3
    Fanatic Member
    Join Date
    Jun 2016
    Location
    España
    Posts
    572

    Re: VB6 GitHub Linebreak Repair

    good job Faf

  4. #4
    Addicted Member
    Join Date
    Feb 2022
    Posts
    217

    Re: VB6 GitHub Linebreak Repair

    Quote Originally Posted by dday9 View Post
    If you're using GitHub, presumably that means you're using Git BASH for version control... Digging around I found the solution above and it has done me well ever since...
    HA! never presume anything, even as a moderator. I haven't known of a VB6 programmer in my lifetime happily using a command prompt for anything... hence the name "Visual"? get it? haha !!! Anyway, it's always great to be aware of command prompt utilities and I thank you for that.

    Otherwise, thank you fafalone for this great little GUI.

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    6,712

    Re: VB6 GitHub Linebreak Repair

    Yeah I don't use GitHub on the desktop at all. Just the web interface. I'm a hobbyist, for my uses I've played around with serious version control but it just wasn't worth the time IMO. If I ever go back to commercial work, then I'd use it for that.

  6. #6
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,880

    Re: VB6 GitHub Linebreak Repair

    Essential tool for all VB6ers using github.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  7. #7
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,690

    Re: VB6 GitHub Linebreak Repair

    Quote Originally Posted by yereverluvinuncleber View Post
    Essential tool for all VB6ers using github.
    This or just use git client to fetch repos, not Download button.

    I mean git clone https://www.github.com/user/repo from command line should work most of the time (always) unless local git config is bonkers.

    cheers,
    </wqw>

  8. #8
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,880

    Re: VB6 GitHub Linebreak Repair

    I always clone a repo. and that works for me. However, some do not, resulting in the raising of the issue after a download.

    I executed the command line above
    Code:
    git config --global core.autocrlf true
    and it went "in", we'll just have to see if it works with my next release.

    I doubt I will ever become fully cognisant of the various git command line actions, so the desktop UI is what I use.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width